I have cookieParser on the server and have cors co...
# random
m
I have cookieParser on the server and have cors configured correctly e,g:
j
Are you interacting with graphql playground or a website?
m
via the website
which is being run locally
at localhost:7777
j
And if you try to log, from the browser console,
document.cookie
. Can you see it?
m
nothing appears to be showing
j
Which library are you using to interact with your GraphQL server?
m
it's the yoga server so express
on the front end it's react-apollo
j
From the website. *
Okay, thanks.
m
the mutation seems to work, fine, i.e. I get the user back after signing in and then route to a dashboard, but the cookie remains unset
j
Are you using ApolloBoost or do you manually configure your client?
m
I'm using Apollo boost
import withApollo from "next-with-apollo"; import ApolloClient from "apollo-boost"; import { API_ENDPOINT } from "../config"; function createClient({ headers }) { return new ApolloClient({ uri: API_ENDPOINT, request: operation => { operation.setContext({ fetchOptions: { credential: "include" }, headers }); } }); } export default withApollo(createClient);
j
You need to include
credentials: 'include'
when you configure the client.
m
ahhhh
🤦‍♂️
j
Works? 🙂
m
yep
j
Woop! Have fun 🦜
m
I think... I love you
thanks so much
j
No worries, fam! Happy easter! 🥚
m
dammit, 3 hours looking for that! thanks so much!
I'm eternally grateful
j
Now you're making me blush. It's nothing. Been there myself!
m
happy easter! 🥚