[英]How to upload and retrieve the files from Google drive with static credentials android
I have the requirement of saving files to google drive of Admin account and then retrieving. 我需要将文件保存到Admin帐户的Google驱动器中,然后进行检索。 Now i am able to upload the files to Users google drive account which is in his phone, i am not able to give static credentials of my drive.
现在,我可以将文件上传到他手机中的用户Google驱动器帐户,我无法提供驱动器的静态凭据。 Is there any Possibility?Please give the reference of giving static credentials to the google drive to save and retrieve the files.
有任何可能吗?请提供给Google驱动器静态凭证的参考,以保存和检索文件。
First, be aware of the security implications of embedding static credentials. 首先,请注意嵌入静态凭据的安全隐患。 As a minimum, use only drive.file scope, so the credentials only allow access to files created by the app.
至少,仅使用drive.file范围,因此凭据仅允许访问由应用程序创建的文件。
The "static credential" you are referring to is a Refresh Token. 您所指的“静态凭证”是刷新令牌。 You will use this to fetch an Access Token whenever your app needs to access GDrive.
每当您的应用需要访问GDrive时,您将使用它来获取访问令牌。 This answer How do I authorise an app (web or installed) without user intervention?
此答案如何在没有用户干预的情况下授权应用程序(网络或已安装)? (canonical ?) describes the detailed steps to follow.
(规范?)描述了要执行的详细步骤。
You should also consider using a Service Account instead of a regular account for the app's storage. 您还应该考虑使用服务帐户而不是常规帐户来存储应用程序。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.