简体   繁体   中英

Firebase Phone Auth reCAPTCHA verification not working on some devices

I am building iOS application using Firebase UI Phone Authentication latest version of Firebase Auth.

When I tried to perform login using Phone Number on my device and it seem likes it doesn't require the reCAPTCHA verification and it works.

Instead when I tried to run the application on other devices it requires reCAPTCHA verification but suddenly when the completion the verification that you're not robot I have seen the screen stays in blank and not working.

I have searched few answers on Stack Overflow and mentioned about enabling something in Background Modes (I have enabled Remote Notifications, Background Fetch, Voice over IP, Audio, Airplay...). Other thing they mentioned about REVERSED_CLIENT_ID in GoogleService file that I have to copy that URL to to URL Schemes, Of course I have copied it.

Here are some of my delegate functions:

func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
    let firebaseAuth = Auth.auth()
    if (firebaseAuth.canHandleNotification(userInfo)){
        print("User infor ",userInfo)
        return
    }
}

func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {

    let token = deviceToken.hexString
    print("====== This is device token ",deviceToken)

    let firebaseAuth = Auth.auth()
    // I used to set type .unknown to .prod as well and it doesn't work
    firebaseAuth.setAPNSToken(deviceToken, type: .unknown)
    InstanceID.instanceID().instanceID { (result, error) in
        if let error = error {
            NSLog("Error getting instance ID ", error.localizedDescription)
        } else if let result = result {
            Messaging.messaging().apnsToken = deviceToken
            UserDefaults.standard.setFCMToken(value: result.token)
        }
    }
    print("=============== Device token",deviceToken.description)
    if let uuid = UIDevice.current.identifierForVendor?.uuidString {
        print(uuid)
    }
    UserDefaults.standard.setValue(token, forKey: "ApplicationIdentifier")
    UserDefaults.standard.synchronize()


}

Is there anything else that I missed? Why it doesn't work on other iOS devices?? Why does it require reCAPTCHA verification and then after verified and screen keeps blank ??

Enter The Below Code before you ask for VerificationID.

Auth.auth().settings?.isAppVerificationDisabledForTesting = true

Check Documentation

I'm not sure what iOS version you are running but there is a problem in reCAPTCHA for iOS 13 and it's not solved yet

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM