I'm trying to apply server side authentication in a similar way to how getServerSideProps()
works in the older /pages
approach to nextjs.
However with this approach getServerSideProps
takes a context parameter which contains both the req
and res
from the server. Which means we could attach headers to the response.
Is this context (or parts) accessible in the new Server Components
within nextjs 13?
I know I can access cookies and headers for the request using the next/cookies
and next/headers
- is there a way to access the response? Current cookies.set()
function doesn't work (throws an error), do I need have to wait for this to be implemented?