# After linking accounts in the context of a rule pipeline, is there a way to continue the pipeline with the 'master' user (the user whose account has become the master account)?

**URL:** <https://community.auth0.com/t/after-linking-accounts-in-the-context-of-a-rule-pipeline-is-there-a-way-to-continue-the-pipeline-with-the-master-user-the-user-whose-account-has-become-the-master-account/8802>\
**Category:** Get Help\
**Tags:** linki, rule, account\
**Created:** [November 22, 2017, 2:50am UTC](https://community.auth0.com/t/after-linking-accounts-in-the-context-of-a-rule-pipeline-is-there-a-way-to-continue-the-pipeline-with-the-master-user-the-user-whose-account-has-become-the-master-account/8802 "2017-11-22T02:50:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeremy.branecky](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jeremy.branecky/32/27931_2.png) [@jeremy.branecky](https://community.auth0.com/u/jeremy.branecky)\
**Post date:** [November 22, 2017, 2:50am UTC](https://community.auth0.com/t/after-linking-accounts-in-the-context-of-a-rule-pipeline-is-there-a-way-to-continue-the-pipeline-with-the-master-user-the-user-whose-account-has-become-the-master-account/8802/1 "2017-11-22T02:50:45Z")

</div>

For this example, assume original\_user is the account that was used to authenticate the first time, and current\_user is the current user in the rule pipeline. Both original\_user and current\_user have the same e-mail accounts, so they can be linked, and original\_user has some existing app\_metadata properties.

We have a rule pipeline and one of the rules links accounts with the same e-mail address. Our problem is after the accounts are linked, the current\_user app\_metadata is empty and we’d like to use the original\_user’s app\_metadata.

Is there a way to use the updated user (e.g. original\_user + current\_user linked account) in the pipeline **after** the link rule is executed successfully? Or should we simply set the current\_user app\_metadata to equal the original\_user’s app\_metadata after linking?

It seems that in a perfect world, after the linking has been successfully executed within the context of the rule pipeline, the “user” object would automatically be representing the original\_user as described above. Otherwise, the “current\_user” is a lame duck from that point forward (to use a political analogy)

---

<div class="post-metadata">

**Author:** ![jmangelo](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jmangelo/32/7923_2.png) [@jmangelo](https://community.auth0.com/u/jmangelo)\
**Post date:** [November 29, 2017, 8:26pm UTC](https://community.auth0.com/t/after-linking-accounts-in-the-context-of-a-rule-pipeline-is-there-a-way-to-continue-the-pipeline-with-the-master-user-the-user-whose-account-has-become-the-master-account/8802/2 "2017-11-29T20:26:43Z")

</div>

Using the `context.primaryUser` [construct](https://auth0.com/docs/link-accounts#automatic-account-linking) you can already influence which user identity should be used to process the final authentication/authorization response. However, like you mentioned, the `user` object in the rules pipeline itself will not be modified so other rules after linking may not have the whole picture. If you’re in a situation where your requirements mandate that account linking rule is not the last step of the rule pipeline then your suggestion of manually overriding the fields is indeed possible although I could not find formal documentation about such possibility.

---

<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 2, 2018, 5:57am UTC](https://community.auth0.com/t/after-linking-accounts-in-the-context-of-a-rule-pipeline-is-there-a-way-to-continue-the-pipeline-with-the-master-user-the-user-whose-account-has-become-the-master-account/8802/3 "2018-03-02T05:57:30Z")

</div>


