# Unable to Access Secondary User Email After Account Linking in Post-Login Action

**URL:** <https://community.auth0.com/t/unable-to-access-secondary-user-email-after-account-linking-in-post-login-action/185657>\
**Category:** Get Help\
**Tags:** account-linking, user-management\
**Created:** [April 17, 2025, 10:40pm UTC](https://community.auth0.com/t/unable-to-access-secondary-user-email-after-account-linking-in-post-login-action/185657 "2025-04-17T22:40:47Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mourya.andey](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mourya.andey/32/71813_2.png) [@mourya.andey](https://community.auth0.com/u/mourya.andey)\
**Post date:** [April 17, 2025, 10:40pm UTC](https://community.auth0.com/t/unable-to-access-secondary-user-email-after-account-linking-in-post-login-action/185657/1 "2025-04-17T22:40:47Z")

</div>

## Issue Description

I’ve implemented a post-login action that links secondary user accounts to a primary user. The link works correctly - when a secondary user logs in, they get linked to the primary user, and their details are added to the `identities` array of the primary user.

**The problem:** When a secondary user logs in after being linked, I cannot find a way to determine which email address was actually used for this specific login attempt. I can access:

- The primary user’s email
- The full `identities` array containing all linked accounts

However, I cannot determine which of these identities/emails was used for the current login session.

## What I’ve tried

I’ve examined the event object in the post-login action and searched through the user object properties, but I haven’t found any property that indicates which identity was used for the current authentication.

## Question

Is there a way to determine which email address/identity was used in the current login attempt when working with linked accounts in post-login actions?

Any guidance would be greatly appreciated!

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [April 18, 2025, 12:05am UTC](https://community.auth0.com/t/unable-to-access-secondary-user-email-after-account-linking-in-post-login-action/185657/3 "2025-04-18T00:05:57Z")

</div>

Hi @mourya.andey,

Welcome to the Auth0 Community!

You could try calling the `event.user.email` in the post-login action script to determine the current user’s email address.

Once the accounts are linked between the first and second accounts, the secondary identity of the user may no longer exist as a discrete user. In this case, you might call `api.authentication.setPrimaryUser(primary_user_id)` to set the primary user of the linked accounts and indicate that the subject of the login should be changed to the existing primary identity account.

If it helps, here is an example of how to implement account linking in Actions:  
[https://auth0.com/docs/manage-users/user-accounts/user-account-linking/link-user-accounts#example-account-linking-action](https://auth0.com/docs/manage-users/user-accounts/user-account-linking/link-user-accounts#example-account-linking-action)

Kind regards,  
Rueben

---

<div class="post-metadata">

**Author:** ![mourya.andey](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mourya.andey/32/71813_2.png) [@mourya.andey](https://community.auth0.com/u/mourya.andey)\
**Post date:** [April 18, 2025, 12:07am UTC](https://community.auth0.com/t/unable-to-access-secondary-user-email-after-account-linking-in-post-login-action/185657/4 "2025-04-18T00:07:57Z")

</div>

Hey Rueben,

Once the accounts are linked and the user logs in next time through the secondary email, I need access to the secondary email but currently I found no way to get that. Is it currently possible to do it anyway? I don’t need the secondary user to exist as a discrete user, I just need the email the user used to login.

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [April 18, 2025, 5:58pm UTC](https://community.auth0.com/t/unable-to-access-secondary-user-email-after-account-linking-in-post-login-action/185657/5 "2025-04-18T17:58:41Z")

</div>

Hi @mourya.andey,

Thanks for the reply.

I have tested this on my end and found the same observations as you. It looks like the `event.user.email_address` property only returns the primary profile’s email address even when logging in with the secondary profile.

I have also checked the access token and see that it was issued for the primary profile’s `user_id`.

Unfortunately, there is no way to determine in a post login action which email address was used for the login attempt when the accounts are linked.

In this case, it might be worth submitting a #Product Feedback request asking for a property to get the email address of a linked account logging in.

Best,  
Rueben

---

<div class="post-metadata">

**Author:** ![mourya.andey](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mourya.andey/32/71813_2.png) [@mourya.andey](https://community.auth0.com/u/mourya.andey)\
**Post date:** [April 18, 2025, 8:19pm UTC](https://community.auth0.com/t/unable-to-access-secondary-user-email-after-account-linking-in-post-login-action/185657/6 "2025-04-18T20:19:04Z")

</div>

Hi Rueben,

Thanks for your reply. I have already submitted a Product Feedback requesting this.

---

<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:** [May 2, 2025, 8:19pm UTC](https://community.auth0.com/t/unable-to-access-secondary-user-email-after-account-linking-in-post-login-action/185657/7 "2025-05-02T20:19:18Z")

</div>

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