firebase-ios-sdk: FR: Expose user UID in linkWithCredential FIRAuthErrorCodeCredentialAlreadyInUse error
Feature proposal
- Firebase Component: Auth
When we encounter the FIRAuthErrorCodeCredentialAlreadyInUse error when using linkWithCredential, we want to get back the UID of the existing user that owns the credential. We need the UID in order to handle account merging in a “safe” manner. We want to merge user data before we complete signIn(with:) so that we can do the [Firestore] data migration still authenticated as the anonymous user.
I’m linking the FirebaseUI issue I filed before realizing FIRAuth itself doesn’t expose the UID. Originally I thought it was a limitation of FirebaseUI, but after looking at the source I see that FIRAuth does not offer the UID in any capacity. Inside this issue I give the full reasoning for wanting the UID to handle merging accounts. https://github.com/firebase/FirebaseUI-iOS/issues/851
Alternatively, though I don’t know if this is any more feasible, another solution would be to have a function that takes a FIRAuthCredential and returns the associated UID without signing in.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 17 (8 by maintainers)
I opened a new issue for the anonymous account retention, because I believe it has value beyond the scenario discussed in this issue.
The implementation will end up being similar, but adjusted to each platform’s best practices.
Yep, this needs to go through some Firebase-internal API review. Our Auth work has been delayed by some internal stuff so it will be a bit before we’re able to get that API review started, but once it’s begun it should be a relatively light addition.
Sorry for the delay.