User Registration - Link Auth0 User to Local Database User

Hi,

We have a user registration page which asks application specific data from the user to create a user record in our local database. Once the user registers themselves, they will receive an email to verify the just registered account via a link.

We have started using Auth0 as identity provider recently. When a new user is created in our local database, we want to let them create an account in Auth0 as well (delegate it to user), so that they can login to the app using Auth0 credentials (logging in with our local db credentials should be still supported).

We were able to create the new user record on Auth0 using Management API and created a new column in user table (local) to store the user_id of Auth0 user. This way, when an access token is received by app, we extract the Sub from token and search our database to findout who is making the request. This works, but we don’t want to do the linking behind the scenes without user’s consent on the mapping.

We are looking for something like: When user registers in our app, an email is sent to Sign Up or Sign In to Auth0. When the user finds the email and does sign up/sign in, there should be a callback from Auth0 to our App to link the Auth0 user to our local user.

Question: What is the ideal way to achieve this?

Please let me know if something is not clear or additional details are needed.

Regards,
Siva