Auth0 User ID Format and Permitted Special Characters
Last Updated:
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
- Auth0
- User Schema
- API
Solution
What is the format of the user ID?
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].
The user ID permits various 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.
How does Auth0 validate the user ID?
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 Auth0 API returns an error that also provides a regular expression indicating the pattern used.
String does not match pattern ^\S$*