Overview
This article explains the format of the user_id
field in the user schema and clarifies which special characters are permitted, particularly when creating users with the API.
Applies To
- User Schema
Solution
Format
The user_id
in Auth0 is designed to be flexible to accommodate various Identity Providers (IdPs), such as enterprise directories or social providers like Google and Facebook. Each provider may generate its own unique identifier in its own format.
The general format for a user_id
in Auth0 is [provider]|[local_part]
. In some cases, it may also include a protocol, such as [protocol]|[provider]|[local_part]
.
Special Characters
When creating user accounts with the API, a user_id can contain a variety of special characters. For example, a user_id can be created with such characters such as !@£$%^&*()+}{:;|P9
.
Validation
The primary restriction is that the user_id
cannot contain any space characters. If an attempt is made to create a user_id
with a space, the API will return an error which also provides some regex i.e: String does not match pattern ^\S*$ indicating the pattern used.