# What to do if there is a gmail login, and username/password with the same email?

**URL:** <https://community.auth0.com/t/what-to-do-if-there-is-a-gmail-login-and-username-password-with-the-same-email/139570>\
**Category:** Get Help\
**Tags:** user-already-exists, user-management\
**Created:** [July 24, 2024, 1:47am UTC](https://community.auth0.com/t/what-to-do-if-there-is-a-gmail-login-and-username-password-with-the-same-email/139570 "2024-07-24T01:47:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![KevinM](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/kevinm/32/55831_2.png) [@KevinM](https://community.auth0.com/u/KevinM)\
**Post date:** [July 24, 2024, 1:47am UTC](https://community.auth0.com/t/what-to-do-if-there-is-a-gmail-login-and-username-password-with-the-same-email/139570/1 "2024-07-24T01:47:06Z")

</div>

I would like to create a user in my mongoDB user collection when they sign up, one thing I’d like to reconcile is what if user [bob@gmail.com](mailto:bob@gmail.com) signs up via their gmail, but then in the future signs up again via username/password?

These have different user IDs so while they’re technically different users, I’d like to recognize them the same in my API validation. Would it be a best practice to just validate the user is in an account in my backend/API by email address instead of user ID?

The flow would be

1. Client makes a request that includes the Auth0 user information
2. My express middleware checks that the user is a part of the account in mongodb
3. If the user is validated the server sends a response.

---

<div class="post-metadata">

**Author:** ![dawid.matuszczyk](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dawid.matuszczyk/32/74550_2.png) [@dawid.matuszczyk](https://community.auth0.com/u/dawid.matuszczyk)\
**Post date:** [July 24, 2024, 1:46pm UTC](https://community.auth0.com/t/what-to-do-if-there-is-a-gmail-login-and-username-password-with-the-same-email/139570/3 "2024-07-24T13:46:45Z")

</div>

Hi @KevinM

Welcome to the Auth0 Community!

Thank you for posting your question. I would say that User Account Linking could be the perfect solution to your problem. You can read more about account linking here → [User Account Linking](https://auth0.com/docs/manage-users/user-accounts/user-account-linking)

Thanks  
Dawid

---

<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:** [August 7, 2024, 1:47pm UTC](https://community.auth0.com/t/what-to-do-if-there-is-a-gmail-login-and-username-password-with-the-same-email/139570/4 "2024-08-07T13:47:09Z")

</div>

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