Is your feature request related to a problem? Please describe:
Upgrading an anonymous user requires you to link the anonymous account with a credential. This operation will fail if the credential is already associated with another account. A common use case at this point is to sign in to the existing account (so that a single Sign in with Apple button press can intelligently "register" [upgrade the anonymous account] or sign into an existing account with one click).
For a lot of other auth providers the original credential can be reused for the sign in operation. But for Apple, the original credential can't be reused. However, Firebase automatically provides an updated credential key within the error (FIRAuthErrorUserInfoUpdatedCredentialKey) that can be used afterwards for the sign in operation.
Without this updated credential key it's not possible to implement a sign in/register flow using native Apple Sign In for apps that use anonymous accounts.
Describe the solution you'd like:
If FirebaseAuthentication.linkWithApple fails and the firebase error code is 'auth/credential-already-in-use', then there should be an updatedCredentialKey property that's added on to to the error that contains the retry token and a way to then sign in to Firebase using the updated credential.
Describe alternatives you've considered:
From what I've seen, the only alternative would be to show the sign in screen twice to the user, but the UX on this would be confusing and not ideal.
Without the FIRAuthErrorUserInfoUpdatedCredentialKey there are no real/proper alternative solutions that'll work.
Additional context:
This isn't a problem if your app doesn't use anonymous accounts since FirebaseAuthentication.signInWithApple will already either register or login for you.
We only need this for iOS in our app. I'm going to try and implement the iOS fix for this when I get time, but my Swift knowledge isn't great so I'm sure somebody else might be able to get it done faster if they wanted to.
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too