Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

how to use cookie from request headers ?

See original GitHub issue

Hello, I’m trying to use wordpress with wp-graphql and I need to post some mutations from my nuxt front-end. I’m using wp-grapql-cors to login and there is indeed a Set-Cookie in the response headers. Using Postman, I can see the cookie and with authorization tab set to “inherit from parent”, if I post a mutation to create a page for example, it works. But within nuxt, I dont know how to configure “nuxt-grapql-client” in order to have something equivalent ! Any help or example, is welcome ! Thank you. PS: Here is a working generated example code from postman using axios:

var axios = require('axios');
var data = JSON.stringify({
  query: `mutation createPost {
  createPost(input: {
    title: "A nice title"
    content: "some content",
    status: PUBLISH
    }) {
  variables: {}

var config = {
  method: 'post',
  url: 'https://galpon.test/graphql',
  headers: { 
    'Content-Type': 'application/json', 
    'Cookie': 'wordpress_logged_in_0a80706747350ab2bd151dfb3be09ba4=test2%7C1654774457%7CaUXw73nZkYwr1uxZkZwjcRkYPYPkONqJgDqd2jRTP8c%7C04441e5096ef211a79ba62f83e5cf34e1c9cfeffeb9c1933877f6231dc71d0de'
  data : data

.then(function (response) {
.catch(function (error) {

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

cfabcommented, Jun 9, 2022

@cfab If you can create a repo for your project, I’d be willing to help you setup everything. You can also reach out to me on Discord - Diizzayy#1964

@Diizzayy Many thanks for your thorough answer, this is great support ! I’ll let you know if I don’t manage…

douglasgussoncommented, Jun 7, 2022

Hello, @Diizzayy, thanks for the answer.

My application is multitenancy. So, when I make a request, is needed to put an special header to specify what tenant I want to download the API schema. So, I would be greatfull if you allow to put it on requests. If you preffer, I can make a PR.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cookie - HTTP - MDN Web Docs
The Cookie HTTP request header contains stored HTTP cookies associated with the server (i.e. previously sent by the server with the ...
Read more >
HTTP headers | Cookie - GeeksforGeeks
HTTP headers are used to pass additional information with HTTP response or HTTP requests. A cookie is an HTTP request header i.e. used...
Read more >
How are cookies passed in the HTTP protocol? - Stack Overflow
Cookies are passed as HTTP headers, both in the request (client -> server), and in the response ...
Read more >
Manually setting a cookie in your script - Loadster
First of all, click the Add… menu on the step you want to add the cookie for, and choose Add request header. Adding...
Read more >
Chapter 5. Cookies and response headers - CORS in Action
This chapter will introduce two new response headers: Access-Control-Allow-Credentials, which indicates that cookies may be included with requests, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found