08-02-2023, 03:14 PM
I have tried following the instructions on Apollo Client for sending cookies along with the graphql request, but the express server is not receiving any cookies and when I inspect the request it shows that no cookies are being sent with the response.
Following this page:
My code is
const link = createHttpLink({
uri: 'http://localhost:3000/api/graphql',
opts: {
credentials: 'include',
}
});
const client = new ApolloClient({
link,
cache: new InMemoryCache()
});
My setup is very simple, I am just using the create-react-app server on localhost:3000, sending requests on for the api to localhost:5000 (express api server). I can set and retrieve cookies via localhost:3000 on other routes, only Apollo Client is not sending them.
Following this page:
[To see links please register here]
My code is
const link = createHttpLink({
uri: 'http://localhost:3000/api/graphql',
opts: {
credentials: 'include',
}
});
const client = new ApolloClient({
link,
cache: new InMemoryCache()
});
My setup is very simple, I am just using the create-react-app server on localhost:3000, sending requests on for the api to localhost:5000 (express api server). I can set and retrieve cookies via localhost:3000 on other routes, only Apollo Client is not sending them.