Access Cookies to set access token in headers in Next.js 14 and Apollo Client
I’m building a Next.js 14 app with Apollo Client configured for server-side rendering (SSR). I need to access cookies on the server to include an authentication token in the Apollo request headers. However, I’m unable to access cookies using request.cookies.get('accessToken')?.value
within the server-side rendering context. This apolloConfig
is working perfectly fine in the client side using the porvider setup. but I wanna use this in the SSR as well.