For Google Drive API, the drive.file scope seems to give only access to the files created by the app. Is there a scope for Google Drive that gives access to the entire drive? Thanks
You may refer with this documentation. Full access to all files in the user's Drive (https://www.googleapis.com/auth/drive) may be necessary for some apps. An app designed to sync files, for instance, needs this level of access to Drive. Apps with special needs related to listing or reorganizing files might need full scope.
Check the sample code in this GitHub page.
Try this scope :
Google Drive
This will bring Full permissive scope to access all of a user's files
Related
I'm trying to be a good citizen and use the drive.file scope, but I'm hitting some snags and not entirely sure how to work through them.
Overview:
user logs into my application, which uses drive.file scope
my application creates a new Folder in the user's Drive, then creates a File in that folder
the user adds new files to that Folder on their own through the Drive interface
my application searches that Folder and only finds the files it created
How do I allow my web app to read ALL of the files inside of a folder it has created, not just the files it has also created?
I had assumed the answer was in the Permissions API, that perhaps I would create a new Permission, but the docs don't seem to make sense for an API client. Would it be a "user" type permission? If so, I must provide an email address parameter, but what email address should be used for the client? Would it be a "domain" type permission? What domain would I use? Am I just searching for files wrong, and some option would expose the other files to my app?
Thanks in advance!
The documentation specifies that drive.file gives only Per-file access to files created or opened by the app
If you see the descriptions of all other possible scopes, you will relaize that unfortunately there is no such scope that gives you access to all files in a certain folder, but not to any other folder on user's drive.
Thus, the scopes will not help you here.
If you want to have access only to files in a certain folder, you need to implement a workaround.
E.g., you can deploy the WebApp as "You" and ask the user to share the folder of interest with you. Then, the WebApp will only have access to the respective folder.
Is there a way to download files from a specific google drive, by using the google drive api? Currently i can only read the drive of the google user logged in.
Inorder to access data owned by someone on Google drive you need their permission. You can't just access my files unless I let you. The most common method for this is oauth2 but you can also use a service account.
Now if I set a file to public you would be able to read it using an API key but I would have to give you the file id.
I need to implement same thing like whatsapp storing all chat history to google drive on clicking on backup button in app. And same restore it in new device as required.
I have look for below references for implementing this, but some how I was not able to do it successfully.
https://developer.android.com/guide/topics/data/backup.html
https://developer.android.com/guide/topics/data/data-storage.html
https://developer.android.com/guide/topics/data/data-storage.html#db
Will this data backup option will help in my requirements or I need to do something else?
I successfully developed the file upload to google drive folders, but i need that data in the backup tab of google drive with app name.
can any one guide me how I can implement this or provide me some references?
Thanks in advance..!
You may refer with this documentation. The Google Drive API includes a special hidden folder that your app can use to store application data.
Note: This feature now uses the alias appDataFolder in place of appdata and appfolder.
To be able to use your Application Data folder, request access to the following scope:
https://www.googleapis.com/auth/drive.appdata
For more information about scopes and how to request access to them, see Authorizing Your App with Google Drive.
We have been working on a web service (http://www.genomespace.org/) that allows computational biology tools that implement our REST API to, among other things, read and write files stored on "The Cloud".
Our default file storage is a common Amazon S3 bucket, but we now allow users to mount their own private S3 bucket as well as files on Dropbox.
We are now trying to enable similar functionality for Google Drive and have run into some problems unique to Google Drive that we have not encountered with S3 or Dropbox.
Only way to allow clients that are not Google-authenticated to read files unobtrusively is to make the files "Public". Our preference would be that once the user has authorized access to our application via OAuth2, the user files could remain "Private" in Google Drive.
However, even though the user has already authorized our web service to offline access to their "Private" files, we have not found a way to generate a URL that a client authorized by our system can use to GET the file directly without the client being logged into Google as well.
The closest we have come to this functionality has been to change the file permissions to "Anyone with Link", except that for files greater than 20MB Google insists on returning an intermediate web page warning that the file has not been scanned for viruses. In addition to having to mess with file permissions, this would break our existing clients. Only when the file is "Public" and we utilize URLs of the form https://googledrive.com/host/PARENT_FOLDER_ID/FILENAME can non-Google clients read the files without interference.
Have not found any way for clients that are not Google-authenticated to upload a file to Google Drive. Our API allows our authorized clients to PUT files directly to the backing file storage using URLs provided by our server. However, even if a folder is marked "Public", the client requires Google authentication credentials to save to Google Drive. We could deal with both of these issues with intermediate hops through our system (e.g., our web server would first download the file from Google Drive and then allow the client to GET it) however this would be woefully inefficient and, hopefully, unnecessary. These problems have been discussed multiple times before on stackoverflow (e.g. here and here and have read the responses very carefully, but have not seen any recent discussion.
The Google folks direct their API users to post on stackoverflow for support, so I am hoping for a fresh look from insiders.
The general answer is: dont make the drive requests through the user's browser. Insead do everything from your servers. You are the one having the (refresh) tokens for users, so you should make all requests like a proxy between the user and Drive. Same for downloading, you download it and return to the user. As long as you use each drive's token there shouldnt be rate limit/quota issues.
Im using drive api sample code for accessing google drive files in my app.But i cannot access the files that were shared with me.Do i need to change scope of google drive api in ios to access all files shared with me?
To get a list of the files shared with you, you can use the drive.files.list request with the sharedWithMe filter.