Ensuring Unique User_ids in Auth0 Across Multiple Tenants

Problem statement

When the auth0|xyz identifier is generated at Auth0, are these identifiers unique globally across multiple tenants? How is this ensured? Are there specific settings or tenant configurations that force the uniqueness of the User_ids?

Solution

The user ID is guaranteed to be unique within a tenant. A user may have the same user ID property across multiple Auth0 tenants. More information can be found in the documentation Identify Users.

As uniqueness is only guaranteed within a single tenant, the possibility exists that your users may share the same ID in two of your tenants.

As a workaround, when syncing users back to the database, as a suggestion, add the tenant name to an ID, e.g:

user_id = tenant_name + id [ tenantName|auth0|12345678 ]