Graphql-playground: How add cookies in request

Created on 23 Aug 2019  路  10Comments  路  Source: graphql/graphql-playground

This issue pertains to the following package(s):

  • [ ] GraphQL Playground - Electron App
  • [ ] GraphQL Playground HTML
  • [x] GraphQL Playground
  • [ ] GraphQL Playground Express Middleware
  • [ ] GraphQL Playground Hapi Middleware
  • [ ] GraphQL Playground Koa Middleware
  • [ ] GraphQL Playground Lambda Middleware

What OS and OS version are you experiencing the issue(s) on?

mac os 10.14.6

What version of graphql-playground(-electron/-middleware) are you experiencing the issue(s) on?

verssion 1.8.10 (1.8.10.5129)

how add cookies in request.

kinquestion

Most helpful comment

Don't know if it helps, it helped me. Try checking this
'request.credentials': 'omit', // possible values: 'omit', 'include', 'same-origin'

I set it to include and it started working after calling login mutation

All 10 comments

Don't know if it helps, it helped me. Try checking this
'request.credentials': 'omit', // possible values: 'omit', 'include', 'same-origin'

I set it to include and it started working after calling login mutation

Apparantly adding the HTTP-HEADER is swallowed, even with request.credentials set to incude. Setting the cookie from the dev tools also doesn't seem to work. Executing document.cookie = "a=4" doesn't set the cookie in the application view.

Any other workarounds on how to inject cookies?

Using the desktop app, version 1.7.20

Hmm. Apparantly I'm using 1.8.10, but the lower right corner in the settings view shows 1.7.20. How is this possible?

Using the desktop app, version 1.7.20

Same problem for me 1.7.20 in corner (1.8.10 in CMD+,)

{ "editor.cursorShape": "line", "editor.fontFamily": "'Source Code Pro', 'Consolas', 'Inconsolata', 'Droid Sans Mono', 'Monaco', monospace", "editor.fontSize": 14, "editor.reuseHeaders": true, "editor.theme": "dark", "general.betaUpdates": false, "prettier.printWidth": 80, "prettier.tabWidth": 2, "prettier.useTabs": false, "request.credentials": "include", "schema.disableComments": true, "schema.polling.enable": true, "schema.polling.endpointFilter": "*localhost*", "schema.polling.interval": 200000, "tracing.hideTracingResponse": true }

@andylacko's solution works for me on 1.7.23 in Chrome.

I had to reload the page to make it work.

I have this problem too. can't add cookie to http headers.
also when i examine the headers in browser, noticed that Content-Type sent in lowercase like "content-type".
and when i open settings, it shows version 1.7.20 in right bottom corner.
my version: 1.8.10
please fix these problems.
thanks

If you're here because you're attempting to authenticate to access services by spoofing cookies, consider instead using the Authorize header in the HTTP HEADERS section of the Playground as explained here for Reaction Commerce (as an example):

https://docs.reactioncommerce.com/docs/developer-authentication#how-to-get-an-access-token-for-development

Nothing worked for me either. Had to switch GraphQL Playground to Insomnia Core, no such problems there.

I had to use GraphiQL. It allows to add cookies easily

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tpage99 picture tpage99  路  21Comments

nicolas-besnard picture nicolas-besnard  路  22Comments

jazzzz picture jazzzz  路  38Comments

gajus picture gajus  路  20Comments

acao picture acao  路  14Comments