On my NextJS site I created authentication cookies to have the data on any page.
my code :
res.setHeader("Set-Cookie", [
serialize("access_token", access_token, {
httpOnly: true,
secure: process.env.NODE_ENV !== "development",
sameSite: "lax",
path: "/",
}),
serialize("token_type", token_type, {
httpOnly: true,
secure: process.env.NODE_ENV !== "development",
sameSite: "lax",
path: "/",
}),
]);
However, I would like, in another page, to retrieve cookie data (read cookies) to display them on my page.
How I can do that ?