I have this error from firebase that says :
An internal error has occured, print and inspect the error details from more information.
How can I know what the error is??,
here is my code for printing the error
let credential = FIRFacebookAuthProvider.credentialWithAccessToken(FBSDKAccessToken.currentAccessToken().tokenString)
FIRAuth.auth()?.signInWithCredential(credential, completion: {(user, error) in
if error != nil {
SCLAlertView().showError("error #1", subTitle: (error?.localizedDescription)!)
return
}
})
You can convert error from Error to NSError, then get the error code. So you will be able to get the FIRAuthErrorCode.
for example:
let credential = FIRFacebookAuthProvider.credential(withAccessToken: FBSDKAccessToken.current().tokenString)
FIRAuth.auth()?.signIn(with: credential, completion: {(user, error) in
if error != nil {
let castedError = error! as NSError
let firebaseError = FIRAuthErrorCode(rawValue: castedError.code)
if firebaseError != nil {
switch(firebaseError!) {
case .errorCodeWrongPassword:
//do something or break
break
default:
//do something or break
break
}
}
}
})
Check all possible errors in FIRAuthErrorCode here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With