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

How can I change the headers coming from GraphiQL? #38

Closed
cshadek opened this issue Jun 12, 2022 · 10 comments · Fixed by #39
Closed

How can I change the headers coming from GraphiQL? #38

cshadek opened this issue Jun 12, 2022 · 10 comments · Fixed by #39
Labels
question Further information is requested

Comments

@cshadek
Copy link

cshadek commented Jun 12, 2022

My primary use case is to include an access token or user session token for a given user, but there could be other use cases. Is this possible right now?

@cshadek
Copy link
Author

cshadek commented Jun 12, 2022

I'm not entirely sure the best way to accomplish this. There could be another parameter in the Pioneer init to include a list of headers, or maybe a specific parameter for adding a bearer token? This would be immensely helpful to allow Pioneer to work in production.

@d-exclaimation d-exclaimation added the question Further information is requested label Jun 12, 2022
@cshadek
Copy link
Author

cshadek commented Jun 12, 2022

Actually it looks like some versions of GraphiQL have a way to add headers. Would this be a better option?

https://stackoverflow.com/questions/69735713/how-to-enable-header-editor-enable-in-graphiql-rails-gem

@cshadek
Copy link
Author

cshadek commented Jun 12, 2022

graphql/graphiql#1543

@d-exclaimation
Copy link
Owner

Yeah, I didn't notice that, I remembered GraphiQL having one. In this issue, it said that older version of GraphiQL used to have the feature to add headers and that the current version have a bug that somehow removed it. I'll see what I can do beside waiting for that issue to be resolved.

In the mean time, if you don't have to specifically use GraphiQL, you could try using .playground and setting the websocket protocol to .subscriptionTransportWs

@cshadek
Copy link
Author

cshadek commented Jun 12, 2022

It looks like GraphiQL might already support this. Is this a simple change in the config?

graphql/graphiql#1543

@cshadek
Copy link
Author

cshadek commented Jun 12, 2022

It sounds like all we need to do is pass in the headerEditorEnabled prop

@d-exclaimation
Copy link
Owner

Yeah, I'll think I can update it now

@cshadek
Copy link
Author

cshadek commented Jun 12, 2022

Awesome!

@d-exclaimation d-exclaimation linked a pull request Jun 12, 2022 that will close this issue
@d-exclaimation
Copy link
Owner

d-exclaimation commented Jun 12, 2022

Not going to lie, it's a bit weird that it is disabled by default. It should be functioning properly now on v0.6.1. Do let me know if there are more things like this.

@cshadek
Copy link
Author

cshadek commented Jun 12, 2022

Yeah I agree it's a bit weird that's the default.

Will do. Thanks for being so quick to respond! I'll recommend your library to my friends.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants