Problem statement
Can a previous email address be reused for a different user after the email address is changed to a new value?
Solution
The previous email address can be reused if the user is associated with the default Auth0 database, “Username-Password-Authentication.” Here are the steps.
- Create a user with email address, 'user1@example.com’ by going to Auth0 dashboard > User Management > Users > Create User
- Change the user’s email address from 'user1@example.com’ to 'user2@example.com’ using PATCH /api/v2/users/{id} Management API endpoint. Auth0 Management API v2
- Create a new user with the previous email address 'user1@example.com’ using POST /api/v2/users Management API endpoint. Auth0 Management API v2
- Confirm both 'user1@example.com’ and 'user2@example.com’ exist in Auth0 database.
This is also true for the user associated with the custom database. As described in this document Change Email Script Template. A changeEmail function should update the user’s email address in the external database. If the user changes their email address, the previous one is removed from the external database, making the previous one available for reuse.