Next.js Discord

Discord Forum

Cookies not setting properly in Production

Unanswered
Sun bear posted this in #help-forum
Open in Discord
Sun bearOP
Hi n.n, i have created this simple /auth/login route:
export async function GET(Request, Response) {
let {data} = await axios.request(reqOptions);
const {accessToken} = await data;
const response = NextResponse.json({message: "logged succesfully"});

response.cookies.set("access_token", accessToken, {
maxAge: 10800,
path: "/",
sameSite: "Strict",
});
return response;
}
It works perfect locally and when i deploy on Vercel also works great. But afther a while (like 3 hours) it just stops setting the cookies in the browser. I`m getting the access token from a backend hosted in HTTP (amazon).

Also mention that i have 2 pages with the line: export const dynamic = "force-dynamic";
Any idea?...

Next 13.4.4

0 Replies