firebase-ios-sdk: Firebase Authentication's error code seems to be broken after upgrading to 5.4.0
Describe your environment
- Xcode version: Version 10.1 (10B61, latest)
- Firebase SDK version: 5.18.0 (latest)
- Firebase Component: Auth (5.4.0, latest)
Describe the problem
My app’s auth logic was broken after upgrading to Firebase Authentication 5.4.0, so I investigated that.
It seems that FIRAuthErrorCodeInternalError(17999) error started occurring for many requests.
Steps to reproduce:
This is one of the steps to reproduce the issue.
- Login with anonymous Firebase user: success.
- Tried to link the Firebase user to exiting linked Facebook account.
After that, FIRAuthErrorCodeCredentialAlreadyInUse(17025) should return, but after upgrading to Firebase Authentication 5.4.0, FIRAuthErrorCodeInternalError(17999)started returning.
import FirebaseAuth
import FBSDKLoginKit
let firUser = Auth.auth().currentUser!
FBSDKLoginManager().logIn(withReadPermissions: ["public_profile"], from: viewController) { (result, error) in
let fbToken = result!.token!
let credential = FacebookAuthProvider.credential(withAccessToken: fbToken.tokenString)
firUser.linkAndRetrieveData(with: credential, completion: { (result, error) in
// error code should be `FIRAuthErrorCodeCredentialAlreadyInUse(17025)`
// error code is `FIRAuthErrorCodeInternalError(17999)` after upgrading to Firebase Authentication 5.4.0
})
}
I suspect that #2405 is related? 🤔
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 17 (10 by maintainers)
Commits related to this issue
- Don't create credential when VerifyAssertionResponse is empty Fix #2522 — committed to firebase/firebase-ios-sdk by Yue-Wang-Google 5 years ago
- Don't create credential when VerifyAssertionResponse is empty (#2530) Fix #2522 — committed to firebase/firebase-ios-sdk by Yue-Wang-Google 5 years ago
- Use oauthAccessToken instead of IDToken when returnIDPCredential is yes Another fix for #2522 — committed to firebase/firebase-ios-sdk by Yue-Wang-Google 5 years ago
- extract errorMessage directly from response in case of returnIDPCredential=YES Fix #2522. In this case, the server returns an 200 without an error like the following: ``` [response data:] { ... — committed to firebase/firebase-ios-sdk by Yue-Wang-Google 5 years ago
- extract errorMessage directly from response when server returns 200 (#2542) * extract errorMessage directly from response in case of returnIDPCredential=YES Fix #2522. In this case, the server ... — committed to firebase/firebase-ios-sdk by Yue-Wang-Google 5 years ago
Great! I’ll wait for it to be approved by my colleague tomorrow, and after that v5.4.1 will be released.
Thanks for your bug report and testing my fixes. I will also keep my promise to buy you a beer, by the way:)
Or see instructions at https://github.com/firebase/firebase-ios-sdk#accessing-firebase-source-snapshots or wait an hour or so. We’re publishing to CocoaPods now.
I’m very sorry. @mono0926 I must be drunk. Please try #2542 with #2530. (you need both patches, and you need to revert the kReturnIDPCredentialKey comment) I’m very confident that this is the right fix.
Again, thank you for testing and reporting the bug to us! Really appreciated (next time I am in Tokyo I’ll invite you for a beer)!
Thanks for reporting. #2530 did fix the issue when the user is new. However for existing users it seems the new code did return an wrong error. I’m going to reopen the issue. For now you could comment out FIRVerifyAssertionRequest.m’s L154 (which set
body[kReturnIDPCredentialKey]to@YES) or simply revert to the old version, if you need an urgent fix. I’ll fix the bug tomorrow.@mono0926 could you please try #2530 and see if it works for you? It works for me.
@mono0926 thanks for the reply, @renkelvin or @Yue-Wang-Google can you please take a look?