GraphQL schema retrieval with URL and authorization header #54
-
What's the best way to handle the case where an authorization token is needed to retrieve the GraphQL schema?
I do not prefer to store the token inside the |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I would like to be pulling the latest schema from our staging, but to do so I need to include an authorisation header in the schema config. Since this definition lives in I would like to be able to define this config elsewhere in a |
Beta Was this translation helpful? Give feedback.
-
This is now possible with the cli. Configure "plugins": [
{
"name": "@0no-co/graphqlsp",
"tadaOutputLocation": "./graphql-env.d.ts",
"schema": "./graphql/schema.graphql"
}
] And run the CLI command like below. It will output the schema file to the location specified above.
|
Beta Was this translation helpful? Give feedback.
This is now possible with the cli. Configure
tsconfig.json
with a schema option like so:And run the CLI command like below. It will output the schema file to the location specified above.
gql-tada generate-schema $GRAPHQL_URL --header "authorization: $AUTH_TOKEN"