'Error linking Apple account on Firebase: Duplicate credential received. Please try again with a new credential
I'm developing an application using React Native, and authenticating users on Firebase.
I've managed to authenticate and link Google accounts to phone numbers on Firebase using linkWithCredential. However, when I try to do the same with Apple accounts (link Apple account with phone number), it's returning this error:
[Error: [auth/unknown] Duplicate credential received. Please try again with a new credential.]
I understand that reusing credentials to link accounts is not allowed for Apple, and someone has mentioned this issue as well. I saw a solution in the thread - to get the updated credential key from the error message returned by calling error.userInfo[FIRAuthErrorUserInfoUpdatedCredentialKey], and use it to link the Apple account with another account on Firebase. However, I've tried that, and it returned undefined, as shown below.
error.userInfo: {"authCredential": null, "code": "unknown", "message": "Duplicate credential received. Please try again with a new credential.", "nativeErrorMessage": "Duplicate credential received. Please try again with a new credential."}
error.userInfo[FIRAuthErrorUserInfoUpdatedCredentialKey]: undefined
Here are the complete steps to initialise Apple authentication that I've followed, but I can't seem to find a solution to this issue.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
