Problem statement
Identity provider Access Token in the user identities array for OIDC Enterprise Connections is not displayed
Symptoms
There is no Access Token when the user object from API is retrieved, it is not present in the identities array.
user.identities[0].access_token
is empty
Steps to reproduce
- Login with OIDC Enterprise Connection
- Make a request to Auth0 Management API
[https://YOUR_DOMAIN/api/v2/users/$](https://your_domain/api/v2/users/$){user_id}
- Get response.data.identities[0].access_token
- Receiving an Empty array
Cause
Auth0 custom OIDC enterprise connection does not actually support IdP access tokens yet, however there are plans to support it.
Solution
As an alternative you could use a custom social connection:
https://auth0.com/docs/authenticate/identity-providers/social-identity-providers/oauth2
The custom social connection can be configured almost exactly like a custom OIDC enterprise connection since they both use the same OIDC protocol. The only extra piece of work that would be needed is setting up the “Fetch User Profile” script, this is to populate/sync the Auth0 user profile when the user logs in.