我想使用电话身份验证进行 Firebase 登录。 由于我正在开发并且无法访问设备和 Apple 开发者帐户,因此我使用
实现了此功能reCAPTCHA verification
但我得到以下错误
{"error":{"code":403,"message":"Requests from this ios client application are blocked.","errors":[{"message":"Requests from this ios client application are blocked.","domain":"global","reason":"forbidden"}],"status":"PERMISSION_DENIED"}}
我已经实现了它,因为它已在文档中显示。
下面是来自 AppDelegate.swift 的代码:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
FirebaseApp.configure()
return true
}
// For iOS 9+
func application(_ application: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any]) -> Bool {
if Auth.auth().canHandle(url) {
return true
}
return false
// URL not auth related, developer should handle it.
}
下面是来自 ViewController.swift 的代码:
@IBAction func didTapSignUp(_ sender: Any) {
PhoneAuthProvider.provider().verifyPhoneNumber("+919637892151", uiDelegate: nil) { (verificationId, error) in
if let error = error {
// It always comes here
print(error.localizedDescription)
}
if let verificationId = verificationId {
print(verificationId)
UserDefaults.standard.set(verificationId, forKey: "authVerificationID")
}
}
}
最佳答案
关于ios - Firebase 电话身份验证失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51062724/