Firebaseui-ios: Firebase Auth Display reCAPTCHA on Actual iOS devices except some devices

Created on 15 Jul 2019  路  5Comments  路  Source: firebase/FirebaseUI-iOS

Step 1: Are you in the right place?

  • For issues or feature requests related to the code in this repository file a GitHub issue.
  • For general technical questions, post a question on StackOverflow tagged appropriately.
  • For general Firebase discussion, use the firebase-talk google group
  • For help troubleshooting your application that does not fall under one of the above categories, reach out to the personalized Firebase support channel

Step 2: Describe your environment

  • Objective C or Swift: __Swift__
  • iOS version: __12___
  • Firebase SDK version: _____
  • FirebaseUI version: _latest___
  • CocoaPods Version: __lastest__

Step 3: Describe the problem:

When I tried to Sign In using Phone Auth by FirebaseUI on my device it doesn't require the reCAPTCHA to verify that you're are not robot.

But when I tried to test on some other devices after I input phone number and click on verify and then it display the reCAPTCHA to verify that you are not robot. After I done verification and then the screen seem like in blank and it doesn't callback. Even I tried to test on simulator it display the same result.

The reCAPTCHA should display on simulator only, right? Why does it happen on actual device???

Steps to reproduce:

  1. __Before Login I have enabled background modes like (Remote Notifications, Background Fetch, Audio...) Also copied REVERSED_CLIENT_ID from GoogleService to URL CUSTOM SCHEMES on Xcode, and then downloaded the APN CERTIFICATE AND UPLOADED TO FIREBASE__
  2. __Login using phone number on actual device__
  3. __completion the reCAPTCHA verification__
  4. __Return page as blank not doing the next step__

Observed Results:

  • Could not finish the login process on some actual devices after doing the verification reCAPTCHA

Expected Results:

  • reCAPTCHA should be displayed on simulator only, why does it show on actual devices and some devices not display the reCAPTCHA?

Relevant Code:

Code that relevance to firebase setup
```
fileprivate func firebaseConfig() {
FirebaseConfiguration.shared.setLoggerLevel(FirebaseLoggerLevel.min)
FirebaseApp.configure()
authUI = FUIAuth.defaultAuthUI()
authUI?.delegate = self
Messaging.messaging().delegate = self
}

func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String) {
print("========== Firebase registration token: (fcmToken)")
let dataDict:[String: String] = ["token": fcmToken]
NotificationCenter.default.post(name: Notification.Name("FCMToken"), object: nil, userInfo: dataDict)
// TODO: If necessary send token to application server.
// Note: This callback is fired at each app startup and whenever a new token is generated.
}
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {

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

    let firebaseAuth = Auth.auth()
    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()


}

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
    }
}

```

auth

All 5 comments

The captcha will show on device whenever the background notification delivery fails for whatever reason. Silent notification delivery isn't guaranteed, so seeing a captcha from time to time is normal. There's nothing wrong with your implementation.

@morganchen12 Thanks for reply. I am not complaining about displaying the captcha. What I am wondering is that after the completion of verification captcha page only return blank.

Here is similar issue I found on stackoverflow

Please reopen this issue if possible

Have you tried the solution mentioned in the StackOverflow question you linked?

My bad! It doesn't work because I run it on my teammate laptop and he confused to disable Push Notification capabilities.

Was this page helpful?
0 / 5 - 0 ratings