"Error! The Specified New Email Already Exists" - Custom DB Connections
A Custom Database connection with Import mode ON enables the creation of a user profile with an email address in the Username field.
According to the documentation, Adding usernames for database connections, it should not allow storing email as the username.
When trying to change a user's email address to the one used as the username, or signing up a new user with that email address (regular sign-up or through the Management API “POST /api/v2/users”), an error is thrown:
Error! The specified new email already exists
or
The user already exists
However, a search for a user with that email address, using either the Dashboard search function or the Management API Get-Users-By-Email endpoint, does not return that user.
- Custom Database (DB) Connection
- User Profile Creation
- Import / Export
Normally Auth0 will not allow users to be created with emails for usernames, but, for a custom DB, Auth0 will just replicate what was returned by the Custom DB action scripts.
If using the Management API endpoint Get-Users-by-Email it will only search by the email field, so users will not be returned for that email address, but the update API will also check other user identifiers for conflicts, and the user exists error will be displayed.
A backlog item has been created to fix this issue.
As an alternative, it is suggested to export and reimport the users to remove the username attributes entirely:
- Export the entire set of users.
- Trim off all the usernames from the resulting export.
- Re-import it into a new database connection.