【问题标题】:"Invalid Token" when trying to authenticate in IOS real device尝试在 IOS 真机中进行身份验证时出现“Invalid Token”
【发布时间】:2022-01-04 04:55:02
【问题描述】:

您好,您已尝试使用 firebase 的电话身份验证,但失败了。我已经阅读了很多关于这个问题的问题,其中大多数提到在 developer.apple.com 中创建 apn 密钥

也许这可行,但问题是我在其他有权访问同一 firebase 项目的应用中使用了电话身份验证,并且我没有添加任何 apn 密钥。

对于“Delivery Clientes”,我可以使用电话号码进行身份验证,但对于“DeliveryAppRestaurant”则不行。 这是我使用电话号码进行身份验证的第三个应用程序,但我不知道我缺少什么(我知道我从未创建过 apn 密钥,所以我认为这没有必要)。我想我忘记了什么。 我已经在 info Runner 添加了 URL

我仍然收到以下异常:[firebase_auth/invalid-app-credential] 无效令牌。

只有当我在真实设备中测试时才会发生这种情况,在模拟器中运行良好。有什么想法吗?

问候,

【问题讨论】:

    标签: ios flutter firebase-authentication


    【解决方案1】:

    如果有人遇到和我一样的问题。看来如果你的应用有通知服务:

    您应该在 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
               }
    }
    

    【讨论】:

      猜你喜欢
      • 2018-04-18
      • 1970-01-01
      • 2016-05-05
      • 1970-01-01
      • 2016-02-04
      • 2019-09-28
      • 1970-01-01
      • 2018-01-26
      • 2021-09-07
      相关资源
      最近更新 更多