Issue configuring JWT secret with claims_map in Hasura Docker compose

1.6k views Asked by At

I am trying to set claims_map in HASURA_GRAPHQL_JWT_SECRET in my docker compose file using the below config

HASURA_GRAPHQL_JWT_SECRET: '{"type":"HS256","key":"***************************","claims_namespace":"p-clamis-allow","claims_map":{"x-hasura-user-id":{"path":"$.user.id"}}}'

I get the following error:

Invalid interpolation format for "environment" option in service "graphql-engine":"{"type":"HS256","key":"*************************","claims_namespace":"p-clamis-allow","claims_map":{"x-hasura-user-id":{"path":"$.user.id"}}}"**

2

There are 2 answers

3
iamnat On BEST ANSWER

Replace $ with $$ and things should work!

HASURA_GRAPHQL_JWT_SECRET: '{"type":"HS256","key":"***************************","claims_namespace":"p-clamis-allow","claims_map":{"x-hasura-user-id":{"path":"$$.user.id"}}}'

1
Balusamy M On

This will work with

export HASURA_GRAPHQL_JWT_SECRET="{ \"type\": \"HS256\", \"key\": \"***************************\",\"claims_namespace\":\"p-claims-allow\"}"