Using Google IDP token for Google API calls

I’ve spent most of my day trying to figure this one out.

After a user logs into Auth0 with the Google Oauth connection, I can retrieve that user’s IDP token through the Auth0 management API, but am unable to use that token in any form or fashion.

image

Things I’ve tried:

  1. Check the permissions on the auth0 settings of Google Oauth
  2. Using the IDP token in API calls to the approved Google scopes in #1
  3. Exchanging the IDP token for a Google access token via Google’s signInWithIDP method

But no matter what I try, I get some kind of error about invalid tokens from Google.

My only question. Is there ANY tutorial or documentation that exists that walks through either USING or EXCHANGING the IPD token from Google Auth0 and using it to make Google API calls???

2 Likes

Hi @mark20

Welcome to Auth0 Community !!!

Can you please elaborate on what are you trying to achieve with google API calls?

The method you are using at the moment is social authentication and it is to get information from google IDP about the user. This will not give you access to google API but will give you access to resources as configured in Auth0 after the user authenticates with google.

Regards
Jeff

2 Likes

Any of the Google Cloud API libraries. I’ve enabled Contacts and Gmail from auth0 permissions and tried making API calls to Google’s contacts and gmail APIs but always get either a CORS “strict-origin-when-cross-origin” error or a “INVALID_ID_TOKEN” response from Google.