Is it possible to download a private access file from Google drive via api?
The reason I want this is to prevent people from sharing the download link because I want to provide files for paid customer only.
If its not what are my option to provide file download only for paid customers and preventing them from sharing those download links with others?
You may want to set scopes for your users to restrict the level of access. See Download Files.
Downloading the file requires the user to have at least read access. Additionally, your app must be authorized with a scope that allows reading of file content. For example, an app using the drive.readonly.metadata scope would not be authorized to download the file contents. Users with edit permission may restrict downloading by read-only users by setting the viewersCanCopyContent field to true.
You may also want to look at Files especially the viewersCanCopyContent.
viewersCanCopyContent
boolean
Whether users with only reader or commenter permission can copy the file's content. This affects copy, download, and print operations.
Related
Google recently announced that to access certain files on google drive my application should use a resouceKey along with the fileId when trying to access google drive through Api. When I checked the files in my google drive I find that not all files have the new resourceKey. I uploaded a new file and that too does not have the new resourceKey.
This lead me to wonder as to what criteria should a file satisfy to be requiring the new resourceKey?
Basically, the resourceKey is required for users who have not been shared the file specifically with them (that is, files shared with Anyone with the link or Anyone in the domain, but not shared with that user specifically) and which haven't accessed that file previously.
Because of this, files that you own, files that you have accessed before, and files that have been shared with you specifically don't require a resourceKey.
You can check the details of the impacted files on the alert center.
Reference:
Update to some Google Drive file links, admin decision recommended before July 23, 2021
Decide how to apply link-sharing security update to Drive
Access link-shared files using resource keys
Can i share the files which are uploaded in the Application Folder with other Google account users ?
https://developers.google.com/drive/android/appfolder
I want the user uploading the file to maintain an Access Control List.
If Appdata does not support it, is there any other alternative provided by google for it?
Is there a way to get sandboxed, user-selected directory access on any major file service without first getting read level access to their entire filesystem?
There's a lot of talk about "unhosted" static webapps that allow users to access their data from a 3rd party file service (Google Drive, Dropbox, their own server, etc.). The most notable effort I've found so far is remoteStorage.io, but there doesn't seem to be a way with any major provider to let the user select a directory and then use that as a sandbox without breaking their trust (i.e. getting read access to all their files first).
From the user's perspective, the webapp shouldn't have access to anything else on the remote file storage except the one folder the user grants it access to (for example, I might grant a text editor access to my FunnyJokes folder).
The current work around seems to be having the webapp force a specific folder name ahead of time ("this app wants access to /appname_notes"), but that rules out letting the user point it to where they may already have their notes.
Does anyone know of a nice way to do this with Google Drive, Dropbox, or the like?
The user experience that makes the most sense to me is something like...
User opens an unhosted webapp (for example, a basic text editor TextyApp). They click a button to connect with their data.
3rd party auth page appears (for example, Google Drive) and it says "The app TextyApp has requested read/write access to your files. Please select a directory to use."
Confirmation screen: "Grant read/write access to folder FunnyJokes for TextyApp?"
The page redirects back to the webapp with sandboxed accessed to the user-specified folder and the files within it.
This seems like how remote file storage should work, but I haven't found a way to do it yet. Any thoughts/suggestions would be great!
Cheers,
Adam
Edit: To clarify, I'm not talking about storing hidden "application data", but instead letting the user specify a particular directory to sandbox for use with a webapp that they may not want to give broader access to.
The Dropbox Apps API provides the ability to restrict any app using your API key to a single directory of your Dropbox account. So users could create an API key with access to a specific directory and then plug that into your app. However, that's not a user-friendly workflow.
I think the Dropbox Drop-Ins Chooser/Saver API might be close to what you want. The user is presented with a Dropbox file selection popup, and your app only gets access to the specific file(s) that the user selects.
With remoteStorage, sandboxed directory access is currently the default way for apps to request (and users to grant) access to the storage. However, users cannot manually select or enter custom directories during the connect phase.
I work for an un-launched startup that handles a large amount of user media. We are looking to integrate Google Drive as a way for a user to store that media.
Is it possible to have read/write access to a user's Google Drive, after obtaining their permission via OAUTH2? More specifically the ability to create folders on their drive and access them for read/write scenarios.
We would also need to be able to generate direct links to their photos, videos, etc.
We've successfully integrated with Dropbox in this manner and would like to offer Google Drive as an alternative. Are these scenarios possible with Google Drive?
Yes, this is absolutely possible.
You will want to read about our Auth Scopes and determine what the minimal set of scopes are that you need to operate. As an example, drive.file scope will enable you to create files & folders, read them, as well as read/write any existing files that a user explicitly opens with your application.
The 'explicitly open' part can be handled in 2 ways. You can register an 'Open' action for your app in the Drive UI for certain file types and you can use our 'File Picker' widget in your app to enable the user to select which files to open/grant access. You can read about opening files in our docs
The sample app in the docs loads a file into a document and then very nicely keeps the document synchronized across all instances of the app. Awesome!
I don't understand when a user is allowed access to the realtime document. The load / save to the drive file is clearly regulated by permissions, but it seems that if I have the key to a realtime document I can make whatever changes I like to that document. Another user, who is allowed to save to the drive file, can get evil updates to the realtime doc and might naively save them to the backing file.
I've tested this briefly by removing access to a file and verifying that the blocked user can indeed still change the realtime document even after access to the drive file is blocked.
Does anyone know a way to block updates to the realtime document from someone that doesn't have access to the relatively-offline file?
Additionally, I'd like to give each collaborator private space in the document that other collaborators cannot affect. Does anyone know of plans for per-key permissions like Firebase supports?
Access to a Realtime file is restricted with sharing and permissions rights exactly the same way as regular Drive files. No user can modify it if they do not have access.
You can achieve the private collaborators part by having a separate private file. If this is not what you require, please give additional details.