-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Description
I appear to be having an issue whilst using JWT tokens via cookies. For unauthenticated requests, I am not sending a cookie. From the documentation, I'm expecting these requests to use the role set in HASURA_GRAPHQL_UNAUTHORIZED_ROLE. However, instead, i get an error response:
"errors": [
{
"extensions": {
"path": "$",
"code": "invalid-headers"
},
"message": "Could not find access_token in Cookie header"
}
]
}
Authenticated requests with a JWT token work fine. However, we need to make a request first to get an access token that is falling foul of this expectation that there should be a cookie header. The documentation for this UNAUTHORIZED_ROLE talks about authorization header's which we are not using. Is this option supported with JWT cookie authentication?
These are the options being passed to the Hasura docker image:
HASURA_GRAPHQL_JWT_SECRET: '{"type":"HS256", "key": "my_key", "header": { "type": "Cookie", "name": "access_token" } }'
HASURA_GRAPHQL_UNAUTHORIZED_ROLE: public
Comments in the code suggest that it should be using the unauthorized role.
| -- Iff no "Authorization"/"Cookie" header was passed, we will fall back to the |
If i switch to using the authorization header rather than a cookie, and i don't send a header it allows the request to continue, presumably using the UNAUTHORIZED ROLE