I am working on web application rendered via getServerSideProps in Next.js. In function getServerSideProps I set authorization token into header, but currently I am struggling how to get this token from header.
My code:
export async function getServerSideProps(ctx: NextPageContext) {
const token: string = "Sample token"
ctx.res?.setHeader("Authorization", token);
return {
props: {}
}
}
const HomePage: NextPage<{}> = ({}) => {
const token: string = "how to get token here?"
return (
)
}
export default HomePage
I am able to see the token in response via browser.

Thanks for any advice!
Authorizationheader insidegetServerSideProps?