I just tested with the following snippets and it seemed to work (using auth0-spa-js 1.22):
auth0 = await createAuth0Client({
domain: DOMAIN,
client_id: CLIENT_ID,
redirect_uri: URL,
scope: 'openid email profile offline_access',
audience: 'https://example.com'
})
await auth0.loginWithRedirect({
access_type: 'offline',
connection_scope: 'https://www.googleapis.com/auth/calendar',
connection: 'google-oauth2'
})
The user should have both an access_token
and arefresh_token
in the identities array.
Also, make sure that the access token you call Management API (GET /api/v2/users
) with has the read:user_idp_tokens
scope. If not, it will return the identities array without those two attributes.