Search code examples
google-apigoogle-oauthgoogle-developers-console

Structure of google project in developer console


I am implementing Google Drive API and Google Sheets API to my application. How should I go about structuring the project in Google Developers console?

First I created the Drive connection and Oauth2 for it, then filled the verification request with scopes

  • https://www.googleapis.com/auth/drive.file
  • https://www.googleapis.com/auth/userinfo.email

which was verified.

Then I created another Oauth2 for Sheets API and after trying to verify the scopes

  • https://www.googleapis.com/auth/spreadsheets

But my request got denied with message that I already have https://www.googleapis.com/auth/drive.file scope.

So should I create separate project for each API or use same Oauth2 for both of them?


Solution

  • Each application is a project in Google developer console. Assuming you are trying to access user data then you should create Oauth2 credentials and request all of the scopes that you will need for the application.

    If the application is using

    Then you would need to active all three APIs in the Google Developer console. However I think that drive.file scope gives you the same access to all the files in Google drive there fore you dont need the spreadsheets scope.

    https://www.googleapis.com/auth/drive.file View and manage Google Drive files and folders that you have opened or created with this app

    vs

    https://www.googleapis.com/auth/spreadsheets View and manage your spreadsheets in Google Drive