# Account linking using the management API

**URL:** <https://community.auth0.com/t/account-linking-using-the-management-api/84332>\
**Category:** Get Help\
**Tags:** account-linking\
**Created:** [May 31, 2022, 4:07pm UTC](https://community.auth0.com/t/account-linking-using-the-management-api/84332 "2022-05-31T16:07:28Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![gparascandolo](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/gparascandolo/32/38788_2.png) [@gparascandolo](https://community.auth0.com/u/gparascandolo)\
**Post date:** [May 31, 2022, 8:27pm UTC](https://community.auth0.com/t/account-linking-using-the-management-api/84332/2 "2022-05-31T20:27:05Z")

</div>

It depends on which account you are setting as the primary user vs secondary user.

If the user signs up with their Facebook account and it is set as the primary user during account linking, the user should remain logged in as the new facebook account they just signed up with.

If the user signs up with their Facebook account, but [abc@gmail.com](mailto:abc@gmail.com) is set as the primary user, you must also set and return [abc@gmail.com](mailto:abc@gmail.com) as the event.user in the Action. This will let the authentication flow continue for the user and allow them to be remained logged in, but as the original [abc@gmail.com](mailto:abc@gmail.com) account.

Note: I’ve only done this for Auth0 Rules, but for Auth0 Actions please reference this previous community post - specifically the part about returning the “new” primary user in the update

> [@Account linking with Auth0 actions](https://community.auth0.com/t/account-linking-with-auth0-actions/60676):
>
> I have a user with verified e-mail [abc@domain123.com](mailto:abc@domain123.com) in my application, logged in with passwordless. We are now enabling SSO for domain123, and I would like a seamless experience when [abc@domain123.com](mailto:abc@domain123.com) signs in with SSO the first time (in other words, I don’t want to present the user with any account-linking GUI. It should “just” work). I’m aware that there are some potential security vulnerabilities when doing seamless account linking, but in this specific scenario it’s ok. I have been in cont…

---

_[View the full topic](https://community.auth0.com/t/account-linking-using-the-management-api/84332)._
