firebase / firebase/firebase-ios-sdk
FR: Add method to either link a credential or sign in using it
- Dominant language
- C++
- Stars
- 6.7k
- Forks
- 1.8k
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 75
Description
### Feature proposal
* Firebase Component: Auth
Add a method which allows either signing in to an existing account, or linking a credential to the current account, in one call.
For example, a new method in FIRUser
```
- (void) linkOrSignInWithCredential:(FIRAuthCredential *)credential completion:(nullable void (^)(FIRAuthDataResult *_Nullable authResult, NSError *_Nullable error))completion {
//First try linking the given credential to the current user, and invoke the completion with the current user
//If that fails because the credential is already linked to another user, then log in as that user and invoke the completion with the new user
}
```
This cannot be completed currently because certain credentials, eg. OAuth credentials generated from signing in with Apple, may only be used once, due to the requirement of a nonce. The requested behavior is only possible in-app by asking the user to log in twice if the credential is already linked to another user.
Contributor guide
Assessment
This issue has not been assessed yet.