Requesting Google Sheets API scope with Vue auth0-spa-js

I would like to read a user’s Google Spreadsheets from my example Vue app with auth0-spa-js authentication. To do this, I need a specific scope on my access token.

To start, on the Auth0 side, I went to Connections > Social and set up google-oauth2 login, provided my own Client ID and Client Secret, and added Spreadsheets permissions. Now upon login to my app, the Google oauth login process asks me to approve this new read/write Spreadsheet scope. So far so good.

According to Google documentation, the relevant scope URL is:

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

Auth0 docs have an example of how to Pass Scopes to Authorize endpoint using curl. I tried to follow the same idea by adding the connection_scope field in the options passed into Auth0Plugin (and thus, the authorize endpoint):

Vue.use(Auth0Plugin, {
  domain,
  clientId,
  connection: 'google-oauth2',
  connection_scope: 'https://www.googleapis.com/auth/spreadsheets',
  ...

After logging out/in, the token received from Auth0 does not include this scope, just the default ones (profile openid email).

How can I request the Google Sheets scope in the token?

Hi @gecko9,

Welcome to the Community!

Unless I am mistaken, you are trying to use the Auth0 issued access token. You should be looking for the identity provider access token.

This doc may also be useful:

Please let me know if you are following these steps and still encountering issues.

Thanks,
Dan

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.