So we're running into something we dont really understand: When we try to login to facebook, using an account that is already linked (has both Google and Facebook providers), we get the error: auth/account-exists-with-different-credential'. This is using v4.12.1 of the JS SDK.
Code
async loginFacebook() {
const facebookProvider = this.getFacebookProvider();
await this.auth.signInWithRedirect(facebookProvider);
// The error is thrown here, and then caught by the .catch(), which is unexpected, because as mentioned, the accounts are already linked.
const result = await this.afAuth.auth.getRedirectResult()
.catch(this.linkIfDuplicateAccount);
// ... rest of code left out, as its irrelevant.
}
Now before the accounts were linked, we'd expect the above error to be thrown; but after they are linked!? Why does that happen?
A bit of bonus info. Our initial implementation was based on Firebase JS API auth - account-exists-with-different-credential and it seemed to work, only recently did we notice the above.
Also, when we log out a user, we purge the local indexdb database, as our devices can be shared between multiple users, but I don't see that being the problem. Mentioned anyway.