Search code examples
c#google-apigoogle-drive-apigoogle-oauth

Read, write and view metadata of publicly shared files without OAuth2 authorization


I have a url like this to a public Google Drive folder: https://drive.google.com/drive/folders/<fileID>?usp=sharing The permissions are "anyone can edit".

Is it possible to read, write and get information about this folder with the Google Drive API without authentication if the folder in question is public? If not, is there another way to do it without the Google Drive API? If not again, is there another free cloud storage service that offers something like this?


Solution

  • You don't have to provide OAuth2 authentication if the file is public. You only need an API Key. For example you can create a default DriveService

    DriveService service = new DriveService();
    

    Then for each request you must set the Key as your API Key.

    When making a Web Request providing a scope is not necessary if the file is public.

    The big caveat is that you can only read files. To delete, modify or upload files you need to authenticate.