I am trying to figure out how to set up my Auth0 app to handle Google access tokens correctly. I am building an app that allows users to log in and then (in response to webhook triggers) we check their calendar and other resources. The app is a Next JS app using auth0/nextjs-auth0. I understand how to get a Google access token using the management API, however, I am finding that the Google token doesn’t work after a day or so. My understanding is that I need to configure google for offline access and get a refresh token, however I’m not finding any details on how to establish offline access to Google through Auth0 in the Next JS library.
Below is my AUTH0_SCOPES environment variable:
AUTH0_SCOPES='openid profile email offline_access'
I’m handling user authentication using the /api/auth/[…auth0].ts route.
Based on my understanding of the Management API, Auth0 should be re-authenticating my Google connection after I make a request to
/api/v2/users, and each request does succeed and return the full user profile, but it does not seem to be refreshing the Google connection.