No IdP Access Token in Identities Array for OIDC Enterprise Connections

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

  1. Login with OIDC Enterprise Connection
  2. Make a request to Auth0 Management API [https://YOUR_DOMAIN/api/v2/users/$](https://your_domain/api/v2/users/$){user_id}
  3. Get response.data.identities[0].access_token
  4. 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.