Open sayandedotcom opened 3 weeks ago
That's unfortunately impossible, since in that moment you are on the server and the server has no knowledge about the cookies of your Browser.
You can forward cookies from the incoming request (that calls SSR) to the outgoing request that calls your api - but you have to do so manually.
Unfortunately, this is a multi-step process as in Next.js SSR, you don't have access to cookies. So you have to get the cookies in RSC, forward them as props to your ApolloWrapper
component and then add them to the outgoing request.
When transporting cookies as props, ensure to encrypt them, as otherwise they would be readable in the browser, too. Patrick has created a great example for that over here: https://github.com/apollographql/apollo-client-nextjs/issues/281#issuecomment-2057927433
Send credentials from here giving error
app/ApolloWrapper.jsx
file like this thisI want to send Like this
const httpLink = createHttpLink({ uri: "http://localhost:8000/graphql", credentials: "include", });