![](/img/trans.png)
[英]"Invalid Token" when trying to authenticate phone number using firebase
[英]"Invalid Token" when trying to authenticate in IOS real device
您好曾尝试使用 firebase 的电话身份验证,但它失败了。 我已经阅读了很多关于这个问题的问题,其中大多数提到在 developer.apple.com 中创建 apn 密钥
也许这可行,但问题是我在另一个可以访问相同 firebase 项目的应用程序中使用了电话身份验证,并且我没有添加任何 apn 密钥。
对于“Delivery Clientes”,我可以使用电话号码进行身份验证,但对于“DeliveryAppRestaurant”则不行。 这是我使用电话号码进行身份验证的第三个应用程序,但我不知道我缺少什么(我知道我从未创建过 apn 密钥,所以我认为这没有必要)。 我想我忘记了什么。 我已经在 info Runner 添加了 URL
而且我仍然收到以下异常:[firebase_auth/invalid-app-credential] 无效令牌。
只有当我在真实设备中测试时才会发生这种情况,在模拟器中运行良好。 有什么想法吗?
问候,
如果有人遇到和我一样的问题。 似乎如果您的应用程序有通知服务:
您应该在 firebase 上添加 apn 密钥:
此外,如果您对连接 recaptcha 有问题,您可以在 AppDelegate 上添加以下行
//Auth
override func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
let firebaseAuth = Auth.auth()
firebaseAuth.setAPNSToken(deviceToken, type: AuthAPNSTokenType.unknown)
}
override func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
let firebaseAuth = Auth.auth()
if (firebaseAuth.canHandleNotification(userInfo)){
print(userInfo)
return
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.