User_ID Listed as 'SUB'
This article explains why an Auth0 UserID may be returning as 'sub' when using the /userinfo endpoint.
- User_id
- /userinfo endpoint
The /userinfo endpoint is specified as part of the OpenID Connect specification, and from that specification, the user identifier of the end-user should be returned in the sub claim of the /userinfo endpoint response and in the sub claim of ID tokens.
Although internally within the Auth0 user profile, the user identifier is stored in an attribute named user_id, when performing an OIDC conformant flow to get an ID token or call the OIDC /userinfo endpoint, the user identifier will be returned as part of the sub claim.
It is recommended to use the value of sub from /userinfo endpoint as the user identifier.