Firebase 应用检查 + 云功能 : Failed to validate AppCheck token

标签 firebase google-cloud-functions firebase-app-check

我最近在我的 Flutter 应用程序中添加了 Firebase App Check。
我正在使用 https.onCall() 调用 Cloud 函数方法。但是我收到此错误:

>  {"severity":"WARNING","message":"Failed to validate AppCheck token. FirebaseAppCheckError: Decoding App Check token failed. Make sure you passed the entire string JWT which represents the Firebase App Check token.
    at FirebaseAppCheckError.FirebaseError [as constructor] (/Users/foxtom/Desktop/Cloud Functions/functions/node_modules/firebase-admin/lib/utils/error.js:44:28)
    at FirebaseAppCheckError.PrefixedFirebaseError [as constructor] (/Users/foxtom/Desktop/Cloud Functions/functions/node_modules/firebase-admin/lib/utils/error.js:90:28)
    at new FirebaseAppCheckError (/Users/foxtom/Desktop/Cloud Functions/functions/node_modules/firebase-admin/lib/app-check/app-check-api-client-internal.js:187:28)
    at /Users/foxtom/Desktop/Cloud Functions/functions/node_modules/firebase-admin/lib/app-check/token-verifier.js:82:19
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  errorInfo: {
    code: 'app-check/invalid-argument',
    message: 'Decoding App Check token failed. Make sure you passed the entire string JWT which represents the Firebase App Check token.'
  },
 codePrefix: 'app-check'
}"}
>  {"verifications":{"app":"INVALID","auth":"MISSING"},"logging.googleapis.com/labels":{"firebase-log-type":"callable-request-verification"},"severity":"WARNING","message":"Callable request verification failed: AppCheck token was rejected."}
严重性似乎只是警告,但它不执行该功能。我的函数只包含一个 console.log()在我的应用程序中,我有这个错误:
W/FirebaseContextProvider( 6788): Error getting App Check token; using placeholder token instead. Error: com.google.firebase.FirebaseException: Error returned from API. code: 403 body: App attestation failed.
I/flutter ( 6788): Error is : [firebase_functions/unauthenticated] Unauthenticated
我没有强制执行 documentation 中建议的任何操作
这阻止了我使用 Cloud Functions,我可以不再为我的应用程序禁用应用程序检查...
编辑 :
我补充说 Firebase StorageRealTime Database在没有强制执行时,没有任何调试 AppCheck token 就可以正常工作。
我能做什么 ?

最佳答案

我创建了一个可重现的代码示例,您可以在这里看到:https://github.com/nilsreichardt/playground/tree/firebase-app-check-cloud-function-unauthenticated-issue/firebase-app-check-cloud-functions-unauthentificated
因此,我在 FlutterFire 中创建了一个详细的问题。存储库 :https://github.com/FirebaseExtended/flutterfire/issues/6794
第一个解决方法已经发布为 comment我相信会有更多的变通方法或解决方案随之而来。

关于Firebase 应用检查 + 云功能 : Failed to validate AppCheck token,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68679583/

相关文章:

ios - 测试人员无法从 Firebase App Distribution 下载应用程序

javascript - Kotlin 和 Firebase 云函数 update() 方法

ios - map 仅显示最后记录的注释

firebase - 如何从firebase函数中的firebase存储获取图像的尺寸?

node.js - 尝试将谷歌云功能与 node.js 一起使用时,admin.firestore 不是一个功能

swift - 为什么我会收到错误 : Value of type 'Auth' has no member 'useEmulator'

flutter - 使用 flutter 处理 Appcheck 时出错

ios - 在 XCode 中找不到应用程序证明功能

java - Firebase 数据库不显示数据

android - 如何在 android 上为发布和调试配置应用程序检查?