Auth0 Home Blog Docs

Is it possible to override the 'sub' claim in an id_token?

#1

We are migrating users from another IdP. These users already have a user Id assigned by that IdP. Our applications that use our legacy IdP use the ‘sub’ field in the id_token to uniquely identify the user. However, if we migrate to Auth0, I don’t want my app owners to see a new user Id in the ‘sub’ claim when the user signs-in. To them, this would look like a new user.

By default, Auth0 uses the user_id field for the ‘sub’ claim in the id_token.
Is is possible to override this mapping with a different claim in the ‘user_metata’ section of the user profile?

Will this cause problems with exchanging tokens? For instance, will Auth0 have a problem looking up a user if the token it receives has our custom ‘sub’ value instead of the ‘user_id’ value?