簡體   English   中英

Firebase 電話身份驗證 reCAPTCHA 驗證在某些設備上不起作用

[英]Firebase Phone Auth reCAPTCHA verification not working on some devices

我正在使用 Firebase Auth 的 Firebase UI Phone Authentication 最新版本構建 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 驗證,然后驗證后屏幕保持空白?

在您要求 VerificationID 之前輸入以下代碼。

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

檢查文檔

我不確定您運行的是哪個 iOS 版本,但 iOS 13 的 reCAPTCHA 存在問題,但尚未解決

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM