In my previous post I published how to authenticate with Laravel + GraphQL. The current post is to know how run a private query using GraphiQL.
We need to add a new schema in the graphql config file. The new schema need to use
auth:api middleware to allow only registered users use the queries.
You can download the extension here and you can install it in almost any browser: Chrome, Firefox, others.
Now you can go to http://127.0.0.1:8000/graphiql/ and run the query and copy the
Click in the extension icon in your browser.
- Add a new request header and complete the fields:
Bearer $accessToken($accessToken is the value copied in the step 2).
- Click in the button play.
Now go to http://127.0.0.1:8000/graphiql/admin and you will be able to see the private area and run any query or mutation. You can see the code in my github. If you would like to see it live please go here.