use*_*349 14 ios firebase-authentication flutter
我已经开始根据官方文档在 Flutter 中设置 Firebase 电话身份验证。不幸的是,无论我如何尝试,我都会FirebaseAuthException在方法verificationFailed的回调中得到verifyPhoneNumber以下值:
code: "invalid-app-credential"
credential: null
email: null
message: "Token mismatch"
phoneNumber: null
plugin: "firebase_auth"
stackTrace: null
tenantId: null
Run Code Online (Sandbox Code Playgroud)
我创建了一个简单的存储库来重现该问题:https ://github.com/peternagy1332/basic_phone_auth
flutterfire configure将应用程序添加到现有的 Firebase 项目并在那里创建 IOS 应用程序。firebase_core@2.1.1和firebase_auth@4.1.1Push notification和Background modes功能以及Background fetch和Remote notifications选项。REVERSED_CLIENT_IDfrom添加GoogleService-Info.plist为URL Scheme.Apple Push Notifications service (APNs) service其作为APNs Authentication KeyFirebase 上传。官方文档的设置部分向我指出了此文档。这表明可能需要对 Swift 代码进行额外的修改,但目前还不清楚。我是一名 Flutter 开发人员,而不是一名原生 IOS 开发人员,我认为我实际上不需要做所有这些。
小智 26
override func application(\n _ application: UIApplication,\n didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?\n ) -> Bool {\n FirebaseApp.configure() \n GeneratedPluginRegistrant.register(with: self)\n return super.application(application, didFinishLaunchingWithOptions: launchOptions)\n }\nRun Code Online (Sandbox Code Playgroud)\n override func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {\n let firebaseAuth = Auth.auth()\n firebaseAuth.setAPNSToken(deviceToken, type: AuthAPNSTokenType.unknown)\n }\nRun Code Online (Sandbox Code Playgroud)\nshu*_*ter 12
在 Flutter 应用程序中,我遇到了firebase_auth/invalid-app-credential: Invalid token 错误。对我来说,改变游戏规则的是将其添加APNs auth key到 Firebase 中。为了做到这一点:
1 - 访问 Apple 开发者网站并创建 Apple 推送通知服务(APNs) key。然后下载它。
2 - 上传Firebase > Project Settings > Cloud Messaging > Apple app configurationAPNs 密钥。
| 归档时间: |
|
| 查看次数: |
10289 次 |
| 最近记录: |