Firebase App Check + 云功能:无法验证 AppCheck 令牌

Tom*_*652 5 firebase google-cloud-functions firebase-app-check

我最近在我的 Flutter 应用程序中添加了 Firebase App Check。

我正在使用该方法调用云函数https.onCall()。但是我收到此错误:

>  {"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."}
Run Code Online (Sandbox Code Playgroud)

严重性似乎只是警告,但它不执行该功能。我的函数只包含一个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
Run Code Online (Sandbox Code Playgroud)

我没有强制执行文档中建议的任何内容

这阻止我使用 Cloud Functions,我可以再禁用我的应用程序的应用程序检查...

编辑 :

我添加了这一点Firebase Storage,并且RealTime Database在未强制执行时无需任何调试 AppCheck 令牌即可正常工作。

我能做些什么 ?

Nil*_*rdt 2

我创建了一个可重现的代码示例,您可以在此处看到: https: //github.com/nilsreichardt/playground/tree/firebase-app-check-cloud-function-unauthenticated-issue/firebase-app-check-cloud-functions-未经验证的

因此,我在FlutterFire存储库中创建了一个详细问题:https://github.com/FirebaseExtended/flutterfire/issues/6794

第一个解决方法已经作为评论发布,我确信将会有更多的解决方法或解决方案。