Modify user ID format

Problem statement

I would like to change the default user IDs from “auth0|example@com”
to {{tenantName}}::example@com.

Cause

Auth0 will always add the strategy prefix to a user_id regardless of its source, and this is not configurable. Example prefixes are auth0 / google-oauth2 / samlp etc. The full list is available on the POST connections reference:

Solution

Unfortunately, this is not possible at this time, Auth0 will always prefix a user_id with the strategy of the connection the user is on (“auth0” for a database connection, “google-oauth2” for a Google social connection etc.), and this is not configurable.

You can specify a custom user_id when creating users via the Management API, a first-time login/signup on a Custom Database connection, or by mapping when using a SAML connection for example. However, these will still be prefixed, as mentioned above.

An alternative to give you full control over the ID schema would be to have a secondary ID stored in the user’s app_metadata. This could be added to tokens if required using an Action to make it easily accessible to your applications/APIs:

Please note that when providing your own custom IDs, the responsibility for ensuring IDs are unique across the tenant is on your side. We recommend adding an additional prefix to your custom ID to distinguish between database connections to avoid running into duplicated ID issues between database connections because they will all share the “auth0” strategy prefix regardless of which database connection the user is on.