Auth0 Error "The user already exists" When Creating a New User

Overview

Creating a new user in Auth0 fails with a The user already exists error, even when no user has that email address. This can occur because another user account is using the target email address as its username.

When attempting to create a new user with a specific email address, Auth0 generates the following error message:

 

The user already exists

 

Applies To

  • Auth0
  • User Management
  • Custom Database Connections

Cause

The database connection has the Username attribute enabled. Another existing user in the Auth0 tenant currently uses the target email address as their username. Auth0 enforces uniqueness across both email addresses and usernames within the same connection, preventing the creation of a new user with that email address.

Solution

What steps can be used to locate a user by username in the Auth0 Dashboard?

Locate the user by running a Lucene query in the Auth0 Dashboard, and update the username to free the email address.

  1. Navigate to User Management, and then select Users in the Auth0 Dashboard.
  2. Enter username:"<target_email@domain.com>" in the search bar, select Search by: Lucene Syntax (Advanced).
  3. Select the user from the search results.
  4. Update the Username field to a different value.
  5. Save the changes.
  6. Create the new user with the desired email address.

 

 

What steps are required to locate a user by username using the Management API?

The search process can be automated by answering the Auth0 Management API List or Search Users endpoint to get the user ID, then updating the profile.

  1. Make a GET request to the /api/v2/users endpoint.
  2. Pass the Lucene query in the q parameter using the format q=username:"<target_email@domain.com>".
  3. Review the JSON response to identify the user ID.
  4. Update the user profile to change the username.
  5. Create the new user with the desired email address.

Recommended content

No recommended content found...