Our current stack involves Next.js and Apollo Client. We are using Apollo to fetch data in getServerSideProps, so to SSR our pages. Currently we are using a HttpLink before every request through Apollo client to check if the current jwt of the user (that is stored in a cookie on the user's browser) is expired. For this we send the jwt via a header. If it is we are fetching a new token with the refresh token of the user. We are able to use the new jwt we get to successfully follow through with the request but we are unable to set the new jwt to the user's cookie along with the response of the request he did. Is there any way to do this? Perhaps we can modify the response and add a 'Set-Cookie' header? Please keep in mind, that all this happens on the server side.
Asked
Active
Viewed 270 times
0
-
Please provide enough code so others can better understand or reproduce the problem. – Community Jul 31 '22 at 00:49
-
Does this answer your question? [Next js and Apollo - Cookie not being passed](https://stackoverflow.com/questions/56263624/next-js-and-apollo-cookie-not-being-passed) – jurcola Feb 27 '23 at 15:34