graphql.js icon indicating copy to clipboard operation
graphql.js copied to clipboard

Headers not working (credentials: 'included'?)

Open coolcomfort opened this issue 4 years ago • 3 comments

Hello,

The backend is attempting to set a cookie by using a cookie request. Typically, in front end applications one uses credentials: true or credentials: "included" which then sets the cookie, but this does not seem to be working. In the network tab, I can see the cookie request come in, yet it never actually sticks as a cookie. What setting should I use in my headers to enable credentials?

    var graph = graphql("http://localhost:3000/api/graphql", {
        headers: {
            credentials: "include",
            "Authorization": "",
        },
        asJSON: true,
    });

Thank you

coolcomfort avatar Dec 17 '21 01:12 coolcomfort

I ended up getting this to work, make sure domains are from same origin (aka localhost to localhost, etc).

coolcomfort avatar Dec 17 '21 05:12 coolcomfort