hasura / hasura/graphql-engine
Error: Could not verify JWT: JWSError JWSInvalidSignature Hasura, Docker and Cognito
- Dominant language
- TypeScript
- Stars
- 32.1k
- Forks
- 3k
- PR merge metrics
- PR metrics pending
Description
I'm developing an application in which I use AWS Cognito as authentication provider.
The Hasura Engine is configured in a docker-compose file and it runs in a AWS EC2 machine.
Following this tutorial https://hasura.io/blog/hasura-authentication-explained/#cognito I set HASURA_GRAPHQL_JWT_SECRET as shows below:
```
HASURA_GRAPHQL_JWT_SECRET: '{"type":"RS256","jwk_url":"https://cognito-idp..amazonaws.com//.well-known/jwks.json","claims_format":"stringified_json"}'
```
From the client, I get jwtToken from idToken and put it in authorization header:
```
{
Authorization: 'Bearer '
}
```
Then follows the error:
```
nhandled Rejection (Error): Could not verify JWT: JWSError JWSInvalidSignature: {"response":{"errors":[{"extensions":{"path":"$","code":"invalid-jwt"},"message":"Could not verify JWT: JWSError JWSInvalidSignature"}],"status":200}
```
I don't know if there is any error in my stringified jwks, is it the problem?
As told by @praveenweb in https://github.com/hasura/graphql-engine/issues/3513 I was careful about putting HASURA_GRAPHQL_JWT_SECRET value in a single quote.
Contributor guide
Research direction
Start by reviewing the docker-compose configuration and the HASURA_GRAPHQL_JWT_SECRET value, then compare it with the AWS Cognito token described in the issue. Done means identifying whether the JWT configuration and Authorization header are accepted by Hasura without the JWSInvalidSignature error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, docker, graphql
- Domain
- api, authentication, cloud, devops
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100