Merge User Profiles - Enterprise Connection and Database Connection

Hi,

We have a scenario where users should be able to login with google workspace connection and also with (username, password) where the username and password are stored in Auth0 database.
For example: the sample user with email address username@domain.com exists in Auth0 database domain-users. There is an Google workspace enterprise connection setup in Auth0 tenant with Home Realm Discovery set to domain.com.

We create the database connection user using Management API when the user registers in our application. The enterprise connection user is auto-created on user’s first login using google.

The login works fine on both enterprise connection (sign in with google) and database connection (sign in with username@domain.com and password) individually.

Question:
How do I merge these two profiles into one since both profiles belongs to the same user?

Regards,
Siva

You should be able to use Account Linking to solve this issue.

@mraible Thank you for the reply, I have read the documentation and followed the samples given. If I understand correctly, user need to login with both identities to link them. We have a few client applications so we would have to add the new Link Accounts page/button in multiple applications. So we are wondering if this can be done in a post login action.

The desired flow is:

  1. User logs in to an app with identity 1
  2. There is a post login action that checks if there is a user profile with same email address in other databases (using Auth0 Management API v2 with query parameter q).
  3. If a profile is found, then link it with the profile user already logged in with

Looking at the Management API endpoint Auth0 Management API v2 , I believe we can complete the linking if we pass provider, user_id of the second profile instead of ID token.

I am currently trying to see if this works, will post updates here. Please let me know if this approach is feasible in your opinion.

Regards,
Siva

1 Like