Apollo Client does not pass cookies
See original GitHub issueI am currently using nextJS with apollo and it’s completely unusable for me because the cookie is not passing in every request.
I would be much grateful if someone can just point me to right direction to pass cookies properly.
Even the apollo nextjs example is buggy itself https://github.com/adamsoffer/next-apollo-example
Even in that example, cookies are not being sent in the request.
I am trying every possible way of setting cookies in config without success.
Some people say swapping ApolloClient to ApolloBoost have solved it but neither of the packages work for me.
Below is an example of what I have tried
new ApolloClient({
connectToDevTools: process.browser,
ssrMode: !process.browser, // Disables forceFetch on the server (so queries are only run once)
link: new HttpLink({
uri: APOLLO_ENDPOINT, // Server URL (must be absolute)
opts:{
credentials:'include'
},
credentials: 'include', // Additional fetch() options like `credentials` or `headers`,
}),
cache: new InMemoryCache().restore(initialState || {}),
fetchOptions:{
credentials:'include'
},
credentials:'include'
})
Issue Analytics
- State:
- Created 5 years ago
- Reactions:44
- Comments:89 (2 by maintainers)
Top Results From Across the Web
Cookie not shown/stored in the browser - Help - Apollo GraphQL
Hi,. I have a question regarding cookies. Here I'm using apollo-server-express, express-session and redis for all of the authentication ...
Read more >React Apollo Client not sending cookies - Stack Overflow
This is saying its safe to send along cookies whenever it makes a query to the backend server. So you take this networkInterface...
Read more >apollo client 3 not setting cookies in the browser : r/graphql
I have a MERNG app that is using apollo server w/ express-session (redis for now). in the response header.
Read more >GraphQL, Apollo Studio, and Cookies - Dev Genius
Scenario #1: Apollo Studio connects to your NodeJS GraphQL server, but cookies are not passed. Scenario #2: Apollo Studio refuses to connect ...
Read more >Next.js With Apollo, SSR, Cookies, and Typescript
Newer browsers will prevent you to set third-party cookies if you don't mark them as SameSite=None and Secure . You will need to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Figured it out.
credentials:'include'
should be in the root of the config. Like,I was using inside of
fetchOptions
…I’m pretty sure I’m still having this issue. My rest calls have cookies attached, however my graphql queries don’t.