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

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 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.

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

Thanks
Dawid

1 Like

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