# Disambiguating Amongst Multiple Auth0 Users With Same Email with the Auth0-Returned User Object

**URL:** <https://community.auth0.com/t/disambiguating-amongst-multiple-auth0-users-with-same-email-with-the-auth0-returned-user-object/99667>\
**Category:** Get Help\
**Tags:** user-already-exists, user-management\
**Created:** [February 3, 2023, 3:58pm UTC](https://community.auth0.com/t/disambiguating-amongst-multiple-auth0-users-with-same-email-with-the-auth0-returned-user-object/99667 "2023-02-03T15:58:24Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![robertw](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/robertw/32/59988_2.png) [@robertw](https://community.auth0.com/u/robertw)\
**Post date:** [February 3, 2023, 3:58pm UTC](https://community.auth0.com/t/disambiguating-amongst-multiple-auth0-users-with-same-email-with-the-auth0-returned-user-object/99667/1 "2023-02-03T15:58:24Z")

</div>

The user object returned by useAuth0 (“@auth0/auth0-react”: “^1.12.1”) does not provide the user\_id. Therefore, if there are multiple accounts with the same email address, which would occur where a user registered multiply through different social and auth0 connections, I see no way by which the application could know which of the user account has logged in.

I suppose there might be some scenarios where an application would not need to disambiguate between these accounts, treating them collectively, for its purposes, as the same logical user. However, in my case, my backend will be gleaning user details from the user objects returned by the ‘…/users-by-email’ endpoint, which could differ between the connections and, in any event, I would like to maintain an accurate link between my internal user account and an Auth0 user account.

Is there a tenant application configuration for guarding against the registration of multiple accounts with the same email? Otherwise, do you have any suggestions on how to resolve this?

Thanks!

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [February 6, 2023, 9:11pm UTC](https://community.auth0.com/t/disambiguating-amongst-multiple-auth0-users-with-same-email-with-the-auth0-returned-user-object/99667/3 "2023-02-06T21:11:54Z")

</div>

Hi @robertw,

Welcome to the Auth0 Community!

The object returned _should_ include the user’s Auth0 `user_id`. That object is essentially just the user’s ID token.

Can you share an example of what is returned in that object?

---

<div class="post-metadata">

**Author:** ![robertw](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/robertw/32/59988_2.png) [@robertw](https://community.auth0.com/u/robertw)\
**Post date:** [February 10, 2023, 1:22am UTC](https://community.auth0.com/t/disambiguating-amongst-multiple-auth0-users-with-same-email-with-the-auth0-returned-user-object/99667/6 "2023-02-10T01:22:35Z")

</div>

Thanks for getting back. I believe I found the ‘user’ object’s ‘user\_id’ property, but for some reason it is being named ‘sub’ on the version of the user object that is retrieved by the useAuth0 function of the @auth0/auth0-react library.

Here is the ‘sub’ property value of one of my test accounts:  
auth0|63e54a3012d4e9a01f315f33

```
const { user, isAuthenticated, getAccessTokenSilently, error, logout, loginWithRedirect } = useAuth0();

```

Can I rely on the ‘sub’ property as the source of the user ID?

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [February 10, 2023, 2:17pm UTC](https://community.auth0.com/t/disambiguating-amongst-multiple-auth0-users-with-same-email-with-the-auth0-returned-user-object/99667/7 "2023-02-10T14:17:53Z")

</div>

Hi @robertw,

Yes, you can rely on it. The `sub` claim _is the user\_id_ in this context.

This is a convention from Oauth2/OIDC and is short for _subject_. Your user is the subject of the access token/id token.

Hope that helps!

---

<div class="post-metadata">

**Author:** ![robertw](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/robertw/32/59988_2.png) [@robertw](https://community.auth0.com/u/robertw)\
**Post date:** [March 12, 2023, 1:13pm UTC](https://community.auth0.com/t/disambiguating-amongst-multiple-auth0-users-with-same-email-with-the-auth0-returned-user-object/99667/8 "2023-03-12T13:13:00Z")

</div>

It is working for me, with the user\_id allowing me to retrieve the richer amount of user information readily available from the management API which I call from my resource server

BTW, apologies for my delayed responses as I am not getting email notifications to my O365 tenant. I understand from posts I’ve seen on this forum that there is a system enhancement pending for the Auth0 system to bring it up to the SMTP security progression adopted my MS late last year?

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [March 13, 2023, 12:47pm UTC](https://community.auth0.com/t/disambiguating-amongst-multiple-auth0-users-with-same-email-with-the-auth0-returned-user-object/99667/9 "2023-03-13T12:47:16Z")

</div>

> [@robertw](#):
>
> I understand from posts I’ve seen on this forum that there is a system enhancement pending for the Auth0 system to bring it up to the SMTP security progression adopted my MS late last year?

Hm, I’m not familiar with this, but happy to look into it if you share a link to your reference.

---

<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:** [April 24, 2023, 1:49pm UTC](https://community.auth0.com/t/disambiguating-amongst-multiple-auth0-users-with-same-email-with-the-auth0-returned-user-object/99667/10 "2023-04-24T13:49:51Z")

</div>

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