1
votes

EDIT: I found a similar question specific to the Facebook login. I am using email authentication but the problem / solution may be the same.


I am using the Firebase demo example class SignInViewController and it works well on the demo project. However when I try to integrate it on my own project it gives me the following error:

UserInfo={NSUnderlyingError=0x14704d4b0 {Error Domain=FIRAuthInternalErrorDomain Code=3 "(null)" UserInfo={FIRAuthErrorUserInfoDeserializedResponseKey={type = immutable dict, count = 3, entries => 0 : {contents = "message"} = {contents = "INVALID_EMAIL"} 1 : errors = {type = immutable, count = 1, values = ( 0 : {type = immutable dict, count = 3, entries => 0 : reason = invalid 1 : message = {contents = "INVALID_EMAIL"} 2 : domain = global }

)} 2 : code = {value = +400, type = kCFNumberSInt64Type} } }}, error_name=ERROR_INTERNAL_ERROR, NSLocalizedDescription=An internal error has occurred, print and inspect the error details for more information.}

I enabled the Email login method on the console for the app.

Any idea why this is happening?

1
Without seeing the minimal code with (preferably hard-coded) values you are using, it'll be hard to say what's going on. - Frank van Puffelen
I had a slightly variation of this error. Found a several posts with variants of this error. The thing that varies is the contents property, and in your case says INVALID_MAIL. Sure the e-mail valid? in my case contents was absolutely right. - MiguelSlv

1 Answers

0
votes

Check your settings on dev.facebook in "Login with Facebook" -> "Settings" and paste correct OAuth redirect URIs from Firebase to "Valid OAuth redirect URIs" field. Next enable your Facebook app (should be green). In code paste this:

    func loginButton(loginButton: FBSDKLoginButton!, didCompleteWithResult result: FBSDKLoginManagerLoginResult!, error: NSError!) {
    if error != nil {
        self.showAlert(msg: AlertMessages.facebookLoginError)
        return
    }
    if !result.isCancelled {

        let token = FBSDKAccessToken.currentAccessToken().tokenString
        let credential = FIRFacebookAuthProvider.credentialWithAccessToken(token)
        FIRAuth.auth()?.signInWithCredential(credential) { (user, error) in
            if let error = error {
                UserAuthManager.sharedInstance.logoutFromFacebook()

                if let errCode = FIRAuthErrorCode(rawValue: error.code) { // error
                }
                return
            }
            self.userDidSignedIn()
            //Logged with FB!
        }
    }
}

Remeber to set FBSDKLoginButtonDelegate in your controller.