Auth0 Home Blog Docs

How to change userId format from auth0|emailaddr to auth0|longguid?



I remember seeing the userId format of auth0|longguid.
Since I now switched to another Auth0 tenant, the format I see is auth0|emailaddr.

Is that some recent change in how Auth0 works by default? Or is there a setting for userId format that I could work with?


For database connections managed by Auth0 itself (the actual credentials are stored within the Auth0 service) the default is to use a user identifier format such as auth0|longguid; to my knowledge there were no changes related to this.

On the other hand, if you’re using a custom database connection then the default is to rely on the user identifier coming from the external store. In this case the custom database script is responsible for returning a user profile containing a user_id property. The final identifier will then be the concatenation of that property with the default database prefix which would become auth0|[the_user_id_coming_from_custom_script].

In conclusion, in a custom database script depending on how you’re returning the user profile you can end up with user identifiers of the form auth0|emailaddr. However, that format is not recommended because adding another custom database connection with the same approach could quickly result in duplicate user identifiers. A remedy for this situation would be to include your own prefix before the email address, but if you’re okay with having more opaque user identifiers then your custom script should just return a GUID.


Thank you! That is exactly the information I was looking for. I definitely want to update my custom db script to customize the user_id property.