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
- Client makes a request that includes the Auth0 user information
- My express middleware checks that the user is a part of the account in mongodb
- If the user is validated the server sends a response.