Firebase Authentication email-already-in-use error?

Viewed 1907

I read this section of the Firebase documentation: https://firebase.google.com/docs/reference/js/firebase.auth.Auth.html#getredirectresult

and I can't see the difference between these two errors:

auth/account-exists-with-different-credential
and
auth/email-already-in-use

The former says

Thrown if there already exists an account with the email address asserted by the credential

And the latter says

Thrown if the email corresponding to the credential already exists among your users

This and the rest of the paragraphs say the same thing to me, with different words. Any comments on this would be appreciated. Thank you

1 Answers

From what I see in my tests, I would now say that:

  • auth/account-exists-with-different-credential: happens when the user signs in with a provider credential which is not yet linked to one of our accounts, but which references an email address which is used by one of our accounts

  • auth/email-already-in-use: happens when trying to link a provider credential which is not yet linked to one of our accounts, but which references an email address which is used by one of our accounts

    So basically they are the same thing so far, but happen after different events. In this case, maybe auth/account-exists-with-different-credential should have been used instead, I'll email the Firebase support about this.

    But auth/email-already-in-use also happens when trying to link an email credential while the email is already used by one of our accounts. In which case it does make sense.

Related