Search code examples
firebasejwtauthorizationhasura

Cannot access hasura with Firebase jwt token


Cannot set up role based access to data... Following the documentation for Firebase have set Heroku Config Var:

{
    "type":"RS256",
    "jwk_url": "https://www.googleapis.com/service_accounts/v1/jwk/[email protected]",
    "audience": "geosystem-2021",
    "issuer": "https://securetoken.google.com/geosystem-2021"
}

And sending from Apollo Client Header:

'Authorization': `Bearer ${token}`

The token checked on https://jwt.io/ contains claims:

"https://hasura.io/jwt/claims": {
    "x-hasura-default-role": "biuro",
    "x-hasura-allowed-roles": [
      "biuro"
    ],
    "x-hasura-user-id": "ytBVYInCbCghON3Xv4gXUq9iXsn1"
  },

And still on Hasura API Explorer with selected header : Authorization Bearer oad098sadTOKEN_HERE getting error:

x-hasura-admin-secret/x-hasura-access-key required, but not found

on client:

Unhandled Rejection (Error): x-hasura-admin-secret/x-hasura-access-key required, but not found

With x-hasura-admin-secret everything is working fine but all tables are available, not the ones meant for my user role... What am I missing? Thanks


Solution

  • The problem was related to wrong configuration in Hasura-Heroku panel.