6
votes

I have an App that makes use of Firebase Authentication using phone SMS verification and recaptcha (no APNS)

The App works fine with the Authentication process if you are using iOS 11.4.1

However, if you are on iOS 12, then the Authentication process leads to an invalid token message

Error Domain=FIRAuthErrorDomain Code=17048 "Invalid token." UserInfo={NSLocalizedDescription=Invalid token., error_name=INVALID_APP_CREDENTIAL}

currently using latest firebase ios SDK 5.9.0 latest version of xcode iOS 12 latest Mac OS Mojave 10.14

I saw an earlier issue in June 2018 ( 3 months ago ) but not sure if it relates to our project https://github.com/firebase/firebase-js-sdk/issues/916

https://github.com/firebase/firebase-ios-sdk

Is there a solution around this or is this a Firebase iOS SDK bug?

3
@KENdi Facing the same issue. Did you guys resolve it by any chance?Venugopal Reddy D

3 Answers

5
votes

It seems like there's a problem while using the .p12 file for APNs in Firebase. I was facing the same problem and solved it changing the .p12 certificate for the .p8 instantly changing this, my app receives the SMS.

You can generate the .p8 file in your Apple Developer account in the section 'Keys' download the file and save it in a safe place. This new key also generates a KeyId that would need in the Firebase settings. Finally you would need the TeamId that corresponds to your Apple Developer account, you can found it in the Profile settings.

Hope this can help you.

3
votes

Same Here! I had the exact same problem, turned out that I forgot to set the Identifier to Client in the "URL Types" in the Info of the project.

enter image description here

Hopefully it would work for you.

-1
votes

I am also using same configuration that you describe in your question, and I am using this firebase methods it's perfectly running. so you can check your credential that you are using. Also check firebase docs.

Auth.auth().signIn(withEmail: email, password: password) { (result, error) in

    if error == nil {

        guard let user = result?.user else {
            return
        }
        // do your stuff
    }
}