OneGraph / graphiql-explorer

Explorer plugin for GraphiQL
MIT License
904 stars 97 forks source link

Set authentication headers? #17

Closed fullstackwebdev closed 5 years ago

fullstackwebdev commented 5 years ago

Is it possible to set Authentication headers in OneGraph? Is it missing or hidden? Thanks

grounzero commented 5 years ago

I'd like to know where this is too. I fudged it for the moment by adding it directly to the header of the fetch() call but this will only last as long as the token.

sgrove commented 5 years ago

Copying my answer from our spectrum over here:

Updating the fetch() method is exactly the right thing to do right now. There's no public graphical plugin for editing headers, but it'd be another great plugin that should probably ship with the default GraphiQL, as so many people use it.

On OneGraph's public GraphiQL instance our authentication button was built specifically by us to use our authentication mechanism, so it wouldn't do any good to share that.

That said, building the plugin shouldn't be too difficult - if you would like some help, feel free to post some code and we can if we can help. You can see how tools like GraphiQL.app and GraphiQL Workshop have implemented it:

Long story short: The explorer needs to work with another (non-existent) plugin to set the headers.

sahilrajput03 commented 3 years ago

What is the status for this issue, can't we have something for setting authentication header for onegraph client ?

sgrove commented 3 years ago

@sahilrajput03 Indeed you can - you have your fetch function, don't you?

Feel free to post your code somewhere and I can take a look if you're having trouble!

sahilrajput03 commented 3 years ago

Hmm., I got it resolved as i got an amazing extension from chrome that set the authentication headers for the requests. Thanks man.!. 😇😇