I'm trying to set an 'Authorization' cookie using ...
# orm-help
a
I'm trying to set an 'Authorization' cookie using request.response.cookie in the resolver for my login. Is this the correct way to go about this because a cookie is never set
This should help, also I will suggest you to add cookie parser as well
Also cookies are disabled in graphql playground by default
a
Thanks I did set all that up, I also set up cors on my server with origin: client and credientials: true. I just don't seem to be getting any cookies set which is strange
h
you need to change this
if you are using playground
to this
BTW are you using graphql yoga?
a
Yes I am
Sorry I should have said that
I'm using a react client with apollo-boost
h
ok get this I know this bug related to apollo boost
has plagued me in the past as well
let me give you the workaround
a
I'm having a bit of a play about with the response object inside of the resolver, it seems nothing I do there will actually be sent to the client
h
try adding this
this is not related to yoga
a
Oh wait so I'm hooped using yoga then?
h
This is a client side error
not related to server
so check apollo client not yoga
a
OHH
h
that is why add this to your client
a
With the changes it still does not set a cookie for me
I might just forget about apollo/yoga entirely
h
is your code open, I can check if it is, otherwise it is hard to debug 🙂
l
i have the same issue too and i'm trying to put the token in the cookie and i'm using cookie-parser too but i can not get the cookie from req.cookies seems it's not set
j
Any update on using cookies from mutations @Harshit?
Or has anyone got it working?