title: Storing OAuth credentials in a mongodb database
body: <p>I am trying to add OAuth to my application using react-native(expo), node.js, and mongodb. Currently I am just working on implementing google authentication with the &quot;google-auth-library&quot; package on the backend. I am able to get all of the data that I need (access-token, id-token, email, username, etc.), but I'm not sure how to store that in the database. Along with the google authentication, I also have my own authentication using an email/password combination. The first question I have is, since mongodb automatically generates the objectID for each document, would I have to add a &quot;googleID&quot; field to the User model in order to differentiate the users that sign in using google? It doesn't seem like an optimal solution since if tomorrow if I want to add facebook authentication, I'll have to then add a &quot;facebookID&quot; field and then repeat this for any authentication I want to add. Is there a better way to differentiate users that use different authentication methods? And my other question is, since I have my own authentication, how do I treat the &quot;password&quot; field for users that sign in with google? Since I don't have their password in my database, would I conditionally check their password only if they are signing in with my personal authentication system? And similarly, would I only require a password to be provided from users not using google when they register an account? Hopefully those questions make sense and thank you to anyone who can help.</p>