Search code examples
node.jsauthenticationgoogle-oauthpassport.jssocial-authentication

Is it possible to implement social sign-in and sign-in with email and password both?


Let's suppose user initially signed in website/app using social sign-in (ex: By Google, GitHub etc.).

Is that user will able to login using email and password (same as used for social sign-in) ?

Is it possible ? If Yes, then how ?


Solution

  • Yes.

    When the user initially signed using social sign-in (OAUTH), you can just register their information(like email) into your database.

    But the password can't be same as used for social sign-in because you won't have the user's password through social sign-in (OAUTH).

    You would either ask them to enter a password when using social sign-in or generate a password for them and tell them to keep it.