Login error auth/account-exists-with-different-credential
Hi, When I try to login via Github an error occurr
{error: FirebaseError: Firebase: Error (auth/account-exists-with-different-credential).
Tried to clear the cookies, but without luck. Credentials are ok, because I am able to login to Github. I found similar issue on stack https://stackoverflow.com/questions/44015751/firebase-js-api-auth-account-exists-with-different-credential
When tried login via Google - it's ok
I checked which relevant Firebase settings I have enabled, and I have Link accounts that use the same email, not Create multiple accounts for each identity provider. I think that's the right choice. I'm not sure if that SO question says I need to make a code change.
I can confirm that the same thing just happened to me...
I checked which relevant Firebase settings I have enabled, and I have
Link accounts that use the same email, notCreate multiple accounts for each identity provider. I think that's the right choice. I'm not sure if that SO question says I need to make a code change.
I think you misunderstood that setting. It means that Firebase wont create multiple accounts with the same e-mail address for THE SAME Identity Provider. A new AuthProvider still needs to be manually linked to an existing account, while that is authenticated. I guess automatic linking across Provider would be a security risk, because you can not rely on the email being verified on each provider.
In this scenario, the users account waa created with the EmailProvider and now the user wants to use the GithubProvider with the same email Since the Email must be unique, the error gets thrown, because It cant create a new Account.
The user would have to authenticate with the EmailProvider and link their account with GitHub first. This could be done using some sort of profile page or as a guided process after the error got thrown.
Docs: https://firebase.google.com/docs/auth/web/account-linking