Firebase App Check + 云功能:无法验证 AppCheck 令牌
Firebase App Check + Cloud functions : Failed to validate AppCheck token
我最近在我的 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."}
严重性似乎只是警告但它不执行该功能。我的函数只包含一个 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,我可以再为我的应用程序禁用 App Check...
编辑:
我补充说,Firebase Storage
和 RealTime Database
在没有强制执行任何调试 AppCheck 令牌的情况下工作正常。
我能做什么?
我创建了一个可重现的代码示例,您可以在此处看到:https://github.com/nilsreichardt/playground/tree/firebase-app-check-cloud-function-unauthenticated-issue/firebase-app-check-cloud-functions-unauthentificated
因此,我在FlutterFire repository: https://github.com/FirebaseExtended/flutterfire/issues/6794
中创建了一个详细的问题
第一个变通办法已经作为 comment 发布,我相信会有更多的变通办法或解决方案。
这里是 Firebaser。
感谢您报告此问题 -- 我们现已发布了针对所有平台的修复程序,应该可以解决此问题。详情请参考the Github issue。
我最近在我的 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."}
严重性似乎只是警告但它不执行该功能。我的函数只包含一个 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,我可以再为我的应用程序禁用 App Check...
编辑:
我补充说,Firebase Storage
和 RealTime Database
在没有强制执行任何调试 AppCheck 令牌的情况下工作正常。
我能做什么?
我创建了一个可重现的代码示例,您可以在此处看到:https://github.com/nilsreichardt/playground/tree/firebase-app-check-cloud-function-unauthenticated-issue/firebase-app-check-cloud-functions-unauthentificated
因此,我在FlutterFire repository: https://github.com/FirebaseExtended/flutterfire/issues/6794
中创建了一个详细的问题第一个变通办法已经作为 comment 发布,我相信会有更多的变通办法或解决方案。
这里是 Firebaser。
感谢您报告此问题 -- 我们现已发布了针对所有平台的修复程序,应该可以解决此问题。详情请参考the Github issue。