0

If I create a Test User using an gmail email and password on Firebase Auth using signInWithEmailAndPassword. and then on a next visit sign in using Google Sign in with the same gmail email using signInWithPopup(provider). Then on the next visit I try to sign in with the same email using signInWithEmailAndPassword I get an error code that the

password is incorrect

Shouldn't the correct error code that handles the case where the email is linked to the google Provider so I can prompt user to sign in with google instead of trying to input email and password. Or trying to reset a password.

jasan
  • 11,475
  • 22
  • 57
  • 97

1 Answers1

2

If you create an email/password user and then sign in with a Google user, the Google account will overwrite the email/password account (assuming it is not verified). This is for security reasons, as anyone can create an unverified email/password account, possibly claiming another user's email. Firebase Overwrites Signin with Google Account

If you want to link a Google account to an email account, you can first sign in the user with Google and then currentUser.updatePassword to add a password. The next the user can sign in with Google or email/password.

bojeil
  • 29,642
  • 4
  • 69
  • 76