hasura / hasura/graphql-engine
JWT `claims_map` does not work when `claims_format` is `stringified_json`
- Dominant language
- TypeScript
- Stars
- 32.1k
- Forks
- 3k
- PR merge metrics
- PR metrics pending
Description
### Version Information
Server Version: v2.2.2
### Environment
Cloud
### What is the expected behaviour?
`claims_map` with valid JSONPaths can be used when `claims_format` is `stringified_json`
### Keywords
jwt, claims_map, claims_format, stringified_json, cognito, jsonpath
### What is the current behaviour?
When JWT `claims_format` is `stringified_json`, you are not able to specify a `claims_map` with JSON Paths. If you do, you get the following error when making a query or mutation:
```
JWT claim from claims_map, x-hasura-user-id not found
```
### How to reproduce the issue?
1. Set the `HASURA_GRAPHQL_JWT_SECRET` environmental variable to:
```
{
"type": "RS256",
"jwk_url": "https:///.well-known/jwks.json",
"issuer": "https://",
"claims_namespace": "test",
"claims_format": "stringified_json",
"claims_map": {
"x-hasura-user-id": { "path": "$.test.user_id" },
"x-hasura-default-role": { "path": "$.test.default_role", "default": "user" },
"x-hasura-allowed-roles": { "path": "$.test.roles", "default": ["user"] }
},
"header": { "type": "Authorization" }
}
```
2. Attempt to make a query/mutation
### Any possible solutions?
Sorry, no!
### Can you identify the location in the source code where the problem exists?
No :(
### If the bug is confirmed, would you be willing to submit a PR?
Unfortunately not
Contributor guide
Assessment
This issue has not been assessed yet.