Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Test environment for the google drive API?

How to test safely an app that reads and writes to Google Drive using the API?

I created an app that runs on a server, that basically copies a template google doc to another directory, and then edits this new file.

In order to do that I:

  • created a service account,
  • delegated domain-wide authority to this service account (https://developers.google.com/identity/protocols/OAuth2ServiceAccount#delegatingauthority),

Then the app impersonates a user of the domain (always the same user) to access the API resources.

This app works, but it has 2 problems:

  • the service account has access to too many things. Ideally, I'd like it to have RW access to one folder only,
  • I'd like to create test credentials that would have access to another specific folder only, or even better, another drive.

Thanks!

like image 870
ybycode Avatar asked Jun 17 '19 13:06

ybycode


People also ask

How do I test my Google Drive API?

Go to the Google API Console. Select a project. In the sidebar on the left, expand APIs & auth and select APIs. In the displayed list of available APIs, click the Drive API link and click Enable API.

Is there an API for Google Drive?

The Google Drive API allows you to create apps that leverage Google Drive cloud storage. You can develop applications that integrate with Drive, and create robust functionality in your application using the Drive API.

Are Google Drive APIs free?

All use of the Drive API is available at no additional cost.


1 Answers

Drive does not have permissions based on folders. The closest you can get is by creating an additional Service Account and then share the folder(s) to that SA.

like image 108
pinoyyid Avatar answered Oct 15 '22 02:10

pinoyyid