# Merge User Profiles - Enterprise Connection and Database Connection

**URL:** <https://community.auth0.com/t/merge-user-profiles-enterprise-connection-and-database-connection/119079>\
**Category:** Get Help\
**Tags:** google-workspace-enterprise-connection, connections\
**Created:** [October 21, 2023, 7:33pm UTC](https://community.auth0.com/t/merge-user-profiles-enterprise-connection-and-database-connection/119079 "2023-10-21T19:33:38Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![sivanarisetty](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/sivanarisetty/32/43008_2.png) [@sivanarisetty](https://community.auth0.com/u/sivanarisetty)\
**Post date:** [October 21, 2023, 7:33pm UTC](https://community.auth0.com/t/merge-user-profiles-enterprise-connection-and-database-connection/119079/1 "2023-10-21T19:33:39Z")

</div>

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](mailto: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](http://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](mailto: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

---

<div class="post-metadata">

**Author:** ![mraible](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mraible/32/32776_2.png) [@mraible](https://community.auth0.com/u/mraible)\
**Post date:** [October 22, 2023, 12:29am UTC](https://community.auth0.com/t/merge-user-profiles-enterprise-connection-and-database-connection/119079/2 "2023-10-22T00:29:20Z")

</div>

You should be able to use [Account Linking](https://auth0.com/docs/manage-users/user-accounts/user-account-linking) to solve this issue.

---

<div class="post-metadata">

**Author:** ![sivanarisetty](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/sivanarisetty/32/43008_2.png) [@sivanarisetty](https://community.auth0.com/u/sivanarisetty)\
**Post date:** [October 24, 2023, 8:24pm UTC](https://community.auth0.com/t/merge-user-profiles-enterprise-connection-and-database-connection/119079/3 "2023-10-24T20:24:44Z")

</div>

@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](https://auth0.com/docs/api/management/v2/users/get-users) 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](https://auth0.com/docs/api/management/v2/users/post-identities) , 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

---

<div class="post-metadata">

**Author:** ![moien.tajik](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/moien.tajik/32/49728_2.png) [@moien.tajik](https://community.auth0.com/u/moien.tajik)\
**Post date:** [February 3, 2025, 9:42am UTC](https://community.auth0.com/t/merge-user-profiles-enterprise-connection-and-database-connection/119079/4 "2025-02-03T09:42:39Z")

</div>

Hey @sivanarisetty,  
Were you able to solve this via actions?

---

<div class="post-metadata">

**Author:** ![nik.baleca](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nik.baleca/32/68749_2.png) [@nik.baleca](https://community.auth0.com/u/nik.baleca)\
**Post date:** [February 5, 2025, 12:09am UTC](https://community.auth0.com/t/merge-user-profiles-enterprise-connection-and-database-connection/119079/5 "2025-02-05T00:09:23Z")

</div>

Hi @moien.tajik and everyone

Welcome back to the Auth0 Community!

You can follow the examples provided in our documentation regarding [Linking User Accounts with Actions](https://auth0.com/docs/manage-users/user-accounts/user-account-linking/link-user-accounts).

If you have any other questions, feel free to leave a reply or post on the community page!

Kind Regards,  
Nik

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [March 4, 2025, 6:50pm UTC](https://community.auth0.com/t/merge-user-profiles-enterprise-connection-and-database-connection/119079/7 "2025-03-04T18:50:57Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
