-
Notifications
You must be signed in to change notification settings - Fork 325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OpenAPI forward tenant header to API #229
Comments
GraphQL Mesh is not a server that forwards your requests. It only generates an executable schema that you can even execute using pure graphql-js. So I wouldn't say forwarding headers is a good idea. We are currently working on a PR that implements a feature to pass custom headers using
You can only use sources:
- name: My API
handler:
openapi:
source: http://localhost:8080/api-docs/json
operationHeaders:
X-Tenant-ID: {args.tenantId}
baseUrl: http://localhost:8080 If you do that, GraphQL Mesh detects there must be a shared argument in your root operations, so it will add Or if you pass context without using sources:
- name: My API
handler:
openapi:
source: http://localhost:8080/api-docs/json
operationHeaders:
X-Tenant-ID: {context.tenantId}
baseUrl: http://localhost:8080 or you can use environmental variables; sources:
- name: My API
handler:
openapi:
source: http://localhost:8080/api-docs/json
operationHeaders:
X-Tenant-ID: ${TENANT_ID}
baseUrl: http://localhost:8080 |
Available in 0.1.0 |
Hi guys,
I'm trying to use GraphQL Mesh with a multi-tenant OpenApi 3.0. The OpenApi has a apiKey security scheme described as :
In the GraphQL query I added headers (with Apollo Playground) :
But I can't figure out how to forward this header to the REAST Api. Is there any way yet ?
I noticed that the release 0.0.20 allows to add operationHeaders, so for the moment I can hardcode my tenant header.
Thanks for the amazing job guys !
The text was updated successfully, but these errors were encountered: