ios - Firebase 电话身份验证失败

标签 ios swift firebase firebase-authentication

我想使用电话身份验证进行 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")
        }
    }
}

最佳答案

我关注了this answer并且有效。

“将 Google 控制台中的 API key key 限制设置为无”

不过我很困惑,因为如果只有 NONE 有效,它的目的是什么?

关于ios - Firebase 电话身份验证失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51062724/

相关文章:

swift - 添加 Firebase iOS SDK(4.3.0 或更高版本)或 Unity 插件(6.15.0 或更高版本),然后构建、运行和崩溃您的应用

ios - 如何以编程方式选择 uitableview 行

ios - 如何使用适用于 iOS 的 NSCoder、NSObject 和 Swift 3 解码 Double

ios - 如何将属于 UITableView 中模型数组对象的数组中的数据显示到 tableView?

swift - Xcode 10 存档构建编译失败

javascript - 用于调查结果的 Firebase 数据库

ios - 在 Xcode 中将时间跨度加倍

ios - 如何找出 NSManagedObjectContextObjectsDidChange 关注的 MOC

ios - 发送同步请求 :returningResponse deprecated

javascript - 带有React Hooks的Firebase监听器