Skip to content
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

Add custom header support to GraphiQL #850

Closed
MythicManiac opened this issue Jan 9, 2020 · 8 comments · Fixed by #1016
Closed

Add custom header support to GraphiQL #850

MythicManiac opened this issue Jan 9, 2020 · 8 comments · Fixed by #1016

Comments

@MythicManiac
Copy link

Related issue: graphql/graphiql#500

GraphiQL by default does not implement a way to pass custom request headers, which are still fairly commonly used for example by authentication middleware. It would be nice if graphene-django's built-in GraphiQL view had support for doing authenticated requests with custom HTTP headers.

@francoisihry
Copy link

Yes, without being able to customize the headers, it's not possible to test JWT authentication

@stale stale bot added the wontfix label Jun 30, 2020
@graphql-python graphql-python deleted a comment from stale bot Jul 2, 2020
@stale stale bot removed the wontfix label Jul 2, 2020
@jkimbo
Copy link
Member

jkimbo commented Jul 2, 2020

This seems like a good enhancement. If anyone wants to contribute a PR for this that would be very helpful.

@radekwlsk
Copy link
Contributor

@MythicManiac @jkimbo Hey, I've prepared PR #1016 that adds support for headers introduced to
graphiql graphql/graphiql#1543

@shaozi
Copy link

shaozi commented Aug 16, 2021

How to enable GRAPHIQL_HEADER_EDITOR_ENABLED if I am not using Django?

@ulgens
Copy link
Collaborator

ulgens commented Aug 17, 2021

How to enable GRAPHIQL_HEADER_EDITOR_ENABLED if I am not using Django?

This is graphene-django repository. I'm not sure why would you want to use this tool without Django.

@shaozi
Copy link

shaozi commented Aug 17, 2021

haha, my bad. I found my answer in the flask repo. Thanks!

@wrosko
Copy link

wrosko commented Jun 24, 2022

haha, my bad. I found my answer in the flask repo. Thanks!

@shaozi sorry to bring this up almost a year later. Where can this be done for graphene/flask?

@shaozi
Copy link

shaozi commented Jun 27, 2022

You can download the latest graphiql and make it a template (almost without any changes), then pass it to the app:

GraphQLView.as_view("graphql", schema=schema, graphiql=True,
                                         graphiql_version='1.0.5',
                                         graphiql_template=template,
                                         graphiql_html_title='Graphql-Dev')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants