Giter VIP home page Giter VIP logo

Comments (2)

leebyron avatar leebyron commented on May 3, 2024

As long as that token is read from GET params, then yes. You simply add it as a GET param in the request to graphiql as well.

The idea with the GraphiQL integration is that any GET request to a GraphQL endpoint should also work as a view into GraphiQL by sending the Accept: application/html header that all browsers send.

Try: http://yourserver.com/graphql?token=yourtokenhere&q={__typename}

If this doesn't work for you because your token must be sent via POST params, then you'll need to provide a custom version of GraphiQL. That's not too hard, recycle as much of https://github.com/graphql/express-graphql/blob/master/src/renderGraphiQL.js as you want, adding the POST details to the fetcher and expose it via a different path in your express app.

from express-graphql.

jontonsoup avatar jontonsoup commented on May 3, 2024

Makes sense. Thanks!

Best,

Jon

On Thu, Mar 10, 2016 at 11:40 PM Lee Byron

<
mailto:Lee Byron [email protected]

wrote:

As long as that token is read from GET params, then yes. You simply add it as a GET param in the request to graphiql as well.

The idea with the GraphiQL integration is that any GET request to a GraphQL endpoint should also work as a view into GraphiQL by sending the

Accept: application/html

header that all browsers send.

Try:

http://yourserver.com/graphql?token=yourtokenhere&q={__typename}

If this doesn't work for you because your token must be sent via POST params, then you'll need to provide a custom version of GraphiQL. That's not too hard, recycle as much of
https://github.com/graphql/express-graphql/blob/master/src/renderGraphiQL.js
as you want, adding the POST details to the

fetcher

and expose it via a different path in your

express

app.

Reply to this email directly or
#49 (comment)
.

#49 (comment)

from express-graphql.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.