【问题标题】:Firebase Phone Auth reCAPTCHA verification not working on some devicesFirebase Phone Auth reCAPTCHA 验证在某些设备上不起作用
【发布时间】:2019-11-23 22:40:44
【问题描述】:

我正在使用 Firebase UI Phone Authentication 最新版本的 Firebase Auth 构建 iOS 应用程序。

当我尝试在我的设备上使用电话号码进行登录时,它似乎不需要 reCAPTCHA 验证并且它可以工作。

相反,当我尝试在其他设备上运行该应用程序时,它需要 reCAPTCHA 验证,但突然在完成验证您不是机器人时,我看到屏幕保持空白且无法正常工作。

我在 Stack Overflow 上搜索了几个答案,并提到了在后台模式中启用某些功能(我启用了远程通知、后台获取、IP 语音、音频、Airplay ......)。他们在 GoogleService 文件中提到的其他关于 REVERSED_CLIENT_ID 的事情,我必须将该 URL 复制到 URL Schemes,当然我已经复制了它。

以下是我的一些委托函数:

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()


}

还有什么我错过的吗?为什么它在其他iOS设备上不起作用?为什么需要reCAPTCHA验证,然后验证后屏幕保持空白??

【问题讨论】:

  • 你找到解决办法了吗?

标签: ios firebase firebase-authentication


【解决方案1】:

在您要求验证 ID 之前输入以下代码。

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

Check Documentation

【讨论】:

    【解决方案2】:

    我不确定您运行的是哪个 iOS 版本,但 iOS 13 的 reCAPTCHA 存在问题,尚未解决

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

    【讨论】:

      猜你喜欢
      • 2019-09-18
      • 2019-10-05
      • 2017-05-14
      • 1970-01-01
      • 2015-05-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多