1
votes

I implemented social login using firebase SDK and i tried login using my facebook account l got this error

An account already exists with the same email address but different sign-in credentials. Sign in using a provider associated with this email address

Note I have only facebook and twitter login in my app and my facebook email not have twitter
when I reviewed user at firebase console l already have user with this email that was registered by facebook (the same provider)

How can the same provider generate different credentials?

1

1 Answers

0
votes

You get this error when the user already signed in with the same email using a different provider. eg. user signs up with Twitter using [email protected] and then signs in with Facebook using [email protected].

Since one account per email is enabled in the project settings, the only way to recover in this case is to sign in with the first provider (Twitter in the example above) and then linkWithCredential the Facebook credential to the existing Twitter account. By doing so, the user can sign in to the same account with either provider in the future.

Firebase Auth does this for security reasons. They want to verify that this is the same user signing in and do not want to automatically link without verifying the user's ownership of both account.