hasura / hasura/graphql-engine

Missing 'Authorization' or 'Cookie' header in JWT authentication mode

Open
#9,818 1 comment 0 reactions 0 assignees View on GitHub
k/bug t/gql-services
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

### Version Information

Server Version:
CLI Version (for CLI related issue):

hasura/graphql-engine:v2.9.0

### Environment
Cloud/EKS

### What is the current behaviour?
I am trying to set up subscriptions using the apollo client but I keep getting

My Apollo client config:
`const wsLink = new GraphQLWsLink(
createClient({
url: getGraphqlUrl(true),
options: {
lazy: true,
reconnect: true,
connectionParams: async () => {
const token = await getIdToken();
return {
authorization: token ? `Bearer ${token}` : "",
};
},
},
})
);`

My jwl_url:
`{ "claims_format": "stringified_json", "jwk_url": "https://cognito-idp.us-west-2.amazonaws.com/POOLID/.well-known/jwks.json", "type": "RS256", "header": {"type": "Authorization"}}`

Get the following error in my Hasura Pod:
`Missing 'Authorization' or 'Cookie' header in JWT authentication mode` When I hit my wss endpoint.

### What is the expected behaviour?
I should be able to query my DB using websockets and keep connection alive.

### How to reproduce the issue?

1.
2.
3.

### Screenshots or Screencast

### Please provide any traces or logs that could help here.

### Any possible solutions/workarounds you're aware of?

### Keywords

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the Apollo Client websocket connection described in the issue against the Hasura wss endpoint, then inspect the Hasura pod error. Compare the connection parameters with the JWT header configuration and determine why the Authorization or Cookie header is not recognized. Done means subscriptions can query the database over websockets and keep the connection alive.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api, authentication
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.