Firebase 电话身份验证失败
Posted
技术标签:
【中文标题】Firebase 电话身份验证失败【英文标题】:Firebase phone Authentication failes 【发布时间】:2018-12-06 08:18:20 【问题描述】:我想使用电话身份验证进行 Firebase 登录。 由于我正在开发并且我无法访问设备和 Apple 开发者帐户,所以我使用
来实现此功能reCAPTCHA 验证
但我收到以下错误
"error":"code":403,"message":"来自这个 ios 客户端的请求 应用程序被阻止。","errors":["message":"请求来自 这个 ios 客户端应用程序是 被阻止。","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")
【问题讨论】:
你也在使用 Cordova 吗? 不,纯斯威夫特 请更新您的问题以包含相关代码和 google plist 文件,以便我们尝试提供帮助 您的 API 密钥可能存在一些限制。尝试在 Google Cloud Console 中检查。 它与bundleId有关,现在可以正常工作了。 【参考方案1】:我关注了this answer,它成功了。
"将 Google 控制台中的 API 密钥密钥限制设置为 NONE"
我很困惑,因为如果只有 NONE 有效,它的目的是什么?
【讨论】:
以上是关于Firebase 电话身份验证失败的主要内容,如果未能解决你的问题,请参考以下文章
Firebase 电话身份验证在已投入生产的应用程序上失败,状态码为 17028