factorio-prints icon indicating copy to clipboard operation
factorio-prints copied to clipboard

Login error auth/account-exists-with-different-credential

Open BadDay opened this issue 1 year ago • 3 comments

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

BadDay avatar Nov 18 '24 16:11 BadDay

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.

FactorioBlueprints avatar Nov 19 '24 01:11 FactorioBlueprints

I can confirm that the same thing just happened to me...

grongor avatar Nov 20 '24 20:11 grongor

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 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

maxbethke avatar Jan 15 '25 06:01 maxbethke