无法设置基于角色的数据访问... 按照 Firebase 文档设置 Heroku Config Var:
{
"type":"RS256",
"jwk_url": "https://www.googleapis.com/service_accounts/v1/jwk/<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c6b5a3a5b3b4a3b2a9ada3a886b5bfb5b2a3abe8a1b5a3b4b0afa5a3a7a5a5a9b3a8b2e8a5a9ab" rel="noreferrer noopener nofollow">[email protected]</a>",
"audience": "geosystem-2021",
"issuer": "https://securetoken.google.com/geosystem-2021"
}
并从 Apollo 客户端 header 发送:
'Authorization': `Bearer ${token}`
在 https://jwt.io/
上检查的 token 包含声明:
"https://hasura.io/jwt/claims": {
"x-hasura-default-role": "biuro",
"x-hasura-allowed-roles": [
"biuro"
],
"x-hasura-user-id": "ytBVYInCbCghON3Xv4gXUq9iXsn1"
},
仍然在 Hasura API Explorer 上选择 header :Authorization Bearer oad098sadTOKEN_HERE
出现错误:
x-hasura-admin-secret/x-hasura-access-key required, but not found
在客户端:
Unhandled Rejection (Error): x-hasura-admin-secret/x-hasura-access-key required, but not found
使用x-hasura-admin-secret
一切工作正常,但所有表都可用,而不是适合我的用户角色的表...
我缺少什么?
谢谢
最佳答案
该问题与 Hasura-Heroku 面板中的错误配置有关。
关于firebase - 无法使用 Firebase jwt token 访问 hasura,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66719634/