I am trying to build a unified gateway for my over 50 different graphql endpoints that I want to have them accessed over one gateway and I have choosen to use graphqlmesh. I am bit lost, I can hard code the token, on the mesh configuration but that won't work on a production bases as I would need to pass the generated token to the app,
Currently I can do this
sources:
- name: rick-and-morty
handler:
graphql:
endpoint: https://rickandmortyapi.com/graphql
- name: trevorblades
handler:
graphql:
endpoint: https://countries.trevorblades.com
- name: bff
handler:
graphql:
endpoint: https://teller.com/svc/bff/graphql
source: ./sdl.gql
operationHeaders:
Authorization: Bearer rhuirijjsihjbfejnbsd,ojfjerbfbjihjbefnfnjhiuureiwbanbk
transforms:
- encapsulate:
name: bff
applyTo:
query: true
mutation: true
subscription: true
How can I set this bit
operationHeaders:
Authorization: Bearer rhuirijjsihjbfejnbsd,ojfjerbfbjihjbefnfnjhiuureiwbanbk
to pick the token from postman,
I have tried this
- name: bff
handler:
graphql:
endpoint: https://teller.com/svc/bff/graphql
source: ./sdl.gql
operationHeaders:
Authorization: Bearer {context.headers['x-my-api-token']}
transforms:
- encapsulate:
name: bff
applyTo:
query: true
mutation: true
subscription: true
But the app doesn't come up it ends up throwing an error
AggregateError: Failed on fetching Federated SDL for bff at /Users//WebstormPuserrojects/Kyosk-GraphQL-Gateway/node_modules/@graphql-mesh/merger-stitching/cjs/index.js:49:27 at processTicksAndRejections (node:internal/process/task_queues:96:5) at async Object.getWithSet (/Users/user/WebstormProjects/GraphQL-Gateway/node_modules/@graphql-mesh/store/cjs/index.js:167:38) at async StitchingMerger.replaceFederationSDLWithStitchingSDL (/Users/user/WebstormProjects/GraphQL-Gateway/node_modules/@graphql-mesh/merger-stitching/cjs/index.js:35:25)
how can I set my mesh gateway to accept the bearer token from the clients like postman