Custom Database connection with Import mode ON allows creating a user profile with email in the Username. As per 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”), you will get an error like:
Error!The specified new email already exists
The user already exists.
But if you search for a user with that email address, you will find none, either using the search function in the Dashboard or the Management API ‘GET /api/v2/users-by-email’ endpoint.
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 you use the Management API endpoint ‘GET /api/v2/users-by-email’ it will only search by the email field, so you won’t see any users returned for that email address, but it appears that the update API will also check other user identifiers for conflicts, so you will see the user exists error.
We have a backlog item in place to fix this issue, but in the meantime as an alternative, you can 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, and then re-import it into a new database connection.