Does the call to the /userinfo endpoint return a unique user identifier?

I followed “Angular 2 Authentication Tutorial” and run it successfully.

Does the “profile” that I get by this.auth0.client.userInfo(authResult.accessToken)
contain a unique id? ex: {"sub":"google-oauth2|1169996786XXXX7670996"}.

Can I use 1169996786XXXX7670996 to be my user’s ID on my web application?
If I can not, where I can find the e-mail address which used by user login.

By default, the user identifiers generated by Auth0 will be unique across the same tenant/domain. There are some situations where you are in control of the user identifiers generated so in those situations you would need to ensure the uniqueness yourself.

Based on the information provided you do not seem to be in a situation where you are controlling the user identifiers being generated so you would not need to worry about that part and it would be okay for you to use the sub claim value to uniquely identity the user in association with a single Auth0 tenant/domain.

Have in mind that you need to use the full value of the subclaim as the unique identifier. In your example, you have to use google-oauth2|1169996786XXXX7670996 and not just the 1169996786XXXX7670996 part.

1 Like