简体   繁体   English

我的应用程序用户可以在不提供Gmail用户名或密码的情况下将文件上传到我的Google云端硬盘吗?

[英]Can my app users upload files to my Google Drive, without giving my gmail user nor password?

I am new to combining Google Drive with android. 我是将Google云端硬盘与android相结合的新手。 I have succesfully made this Google Drive sample code work: 我已成功使此Google云端硬盘示例代码起作用:

https://github.com/googledrive/android-quickstart https://github.com/googledrive/android-quickstart

The app does these 4 steps: 1) Asks me to select a gmail account in my phone, or to add an existing one with user/password. 该应用程序执行以下4个步骤:1)要求我在手机中选择一个Gmail帐户,或添加一个具有用户名/密码的现有帐户。 2) The camera opens 3) When the user takes a photo, the app opens an activity, asking me the folder within Google Drive to which I want to save the photo. 2)相机打开3)用户拍照时,应用程序打开一个活动,询问我要保存照片的Google云端硬盘中的文件夹。 4) The photo appears in google drive. 4)照片出现在谷歌驱动器。

I have an existential question that may seem dumb, but I am sure many other android developers may also be asking it: 我有一个似乎很愚蠢的存在性问题,但我敢肯定,许多其他android开发人员也可能会问它:

Can users upload files to MY google drive account, without them having to input MY Google drive's user/password? 用户是否可以将文件上传到我的Google云端硬盘帐户,而无需输入我的Google云端硬盘的用户名/密码? TAKE INTO ACCOUNT: Files are 2 Mb or less This is an R&D app, which means it will not be published in the Play Store, and it will be targeted to a few (20) users within the department. 进入帐户:文件大小不超过2 Mb这是一个R&D应用程序,这意味着它不会在Play商店中发布,并且将面向部门中的几(20)个用户。 That said, security is relaxed. 也就是说,安全性得到了放松。

The short answer is NO . 简短的答案是“ 否” With Google Drive (both GDAA and the REST Api), the android device user identifies her/himself by selecting an existing account on a device (or adding a new one). 使用Google云端硬盘(包括GDAAREST Api),Android设备用户可以通过选择设备上的现有帐户(或添加新帐户)来识别自己。 The app than uploads / downloads objects (files/folders) to that GooDrive account. 然后,该应用会将对象(文件/文件夹)上传/下载到该GooDrive帐户。

The only way this can be accomplished is under the REST Api (DRIVE scope) , you let different users upload files to THEIR OWN GooDrives and share these files with your account (via your email, domain). 可以完成此操作的唯一方法是在REST Api(驱动器范围)下 ,您可以让不同的用户将文件上传到THEIR OWN GooDrives上,并与您的帐户共享这些文件(通过您的电子邮件,域)。 Your account can then see the shared files. 然后,您的帐户可以看到共享文件。 See this. 看到这个。

Obviously, there is still a possibility of creating a specific google account for your application/problem and let all the users share this account with a password known to all of them (but it is not what you were asking). 显然,仍然可以为您的应用程序/问题创建一个特定的Google帐户,并让所有用户使用所有人都知道的密码共享该帐户(但这并不是您要的)。

Good Luck 祝好运

The short answer is Yes it is possible !!! 简短的回答是是的,它是可能的! the app user can directly upload the files to your drive without username and password of that account...which means u have to share the access token of that particular drive account to that app. 应用程序用户可以直接将文件上传到您的驱动器,而无需该帐户的用户名和密码...这意味着您必须将该特定驱动器帐户的访问令牌共享给该应用程序。

Using that access token(credential - setAccessToken ("place your access token here") we can create a service and upload the file. 使用该访问令牌(凭证-setAccessToken (“在此处放置您的访问令牌”)),我们可以创建服务并上传文件。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在我的Android应用中管理Google云端硬盘上的文件 - Managing files on Google Drive in my Android app Google Drive Android API如何将音频文件上传到我的驱动器? 如何同步驱动器文件? - Google Drive Android API how to upload a audio file to my drive ? How to sync drive files? 用户卸载我的应用后,是否会删除Google云端硬盘应用文件夹? - Will the Google Drive appfolder be deleted after a user uninstalls my app? 如何在不部署的情况下将文件上传到我的Google App Engine项目? - how do I upload files to my google app engine project without deploying? 谷歌驱动器复制,团队驱动器(服务)到我的驱动器(用户) - Google Drive Copying, Team Drive (Service) to My Drive (User) 我的应用程序无法在谷歌驱动器的“appDataFolder”中创建文件 - My app can not create file in “appDataFolder” of google drive 无法从我的Android应用com.google.android.gms.auth.GoogleAuthException上传到Google驱动器:未知 - cannot upload to google drive from my android app com.google.android.gms.auth.GoogleAuthException: Unknown 使用Google Drive API备份我的应用 - Using Google Drive API to backup my app 从Java应用程序将文件上传到Google驱动器,而无需用户交互 - upload files to google drive from a java application without user interaction 我如何打开存储在我的Google驱动器中的Word文件到我的应用程序 - How can i open a word file into my app which is stored in my google drive
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM