Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase Auth link provider Google sign in issue?

At the first time, while signup with Gmail and password, firebase saved the credentials correctly. But the next time, I Login with Firebase Google authentication with the same Gmail which i gave while signup, the credentials are overriding in firebase account. After overriding the credentials, we are not able to login using that signup credentials. Can anyone explain how to achieve this?

Signup with Gmail and password

Google authentication

like image 892
Vignesh J Avatar asked Sep 05 '25 03:09

Vignesh J


1 Answers

What happened

In the first screenshot you signed in with the email+password provider of Firebase. While this is a valid sign-in method, it means that anyone could've entered that email address, even if they don't actually have access to the Google account for that gmail address.

There is no security risk here, but the level of trust we can put in the value of email address is low. For this reason the emailVerified property of the account is marked as false and you'll typically want to require that the user verify their email address before allowing them to continue.


In the second screenshot, the user signed in with the same email address, but now with the google.com provider of Firebase. This means that Google now verified already that the user has access to the underlying gmail address of the account. Since the google.com provider is the trusted provider for @gmail.com accounts, the system replaces the previous account.


Also see:

  • Authentication using Facebook at first and then Google causes an error in Firebase for Android
  • Firebase Overwrites Signin with Google Account
  • Trying to understand Firebase Authentication one account per email address and trusted providers

What you can do

You'll typically want to prevent multiple users from signing up with the same email address. For this, you'll want to configure Firebase to only allow a single account per email address in the console, and then use account linking so that the two (email+password and google.com) accounts in your scenario are merged.

like image 51
Frank van Puffelen Avatar answered Sep 07 '25 21:09

Frank van Puffelen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!