简体   繁体   中英

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. I have succesfully made this Google Drive sample code work:

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. 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. 4) The photo appears in google drive.

I have an existential question that may seem dumb, but I am sure many other android developers may also be asking it:

Can users upload files to MY google drive account, without them having to input MY Google drive's user/password? 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. 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). The app than uploads / downloads objects (files/folders) to that GooDrive account.

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). 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).

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM