Reputation: 85
Cases:
Sign in with facebook (working)
Sign in with google with same credetials, firebase overrides login provider (working)
Now again sign in with facebook, firebase doesn't let me sign in and throws the exception:
[firebase_auth/account-exists-with-different-credential] An account already exists with the same email address but different sign-in credentials. Sign in using a provider associated with this email address.
I'm working with Flutter.
As it can be fixed with signInWithPopUp
or SignInWithRedirect
, but these functions don't work with Flutter (only available for web).
Is there any workaround to get it done?
Upvotes: 1
Views: 483
Reputation: 599876
If you want to be able to sign in with both providers, then in step 2 you need to link the second provider to the existing account rather than replace the Facebook account. To detect that you need to do that, you can call the fetchSignInMethodsForEmail
method to find whether there's an existing account for the user's email address.
Upvotes: 1