Bernardo Forcillo
Bernardo Forcillo
HHono
Created by Bernardo Forcillo on 11/24/2024 in #help
Cookie not set 'hono/vercel', zod-openapi...
Hi, i have no idea why this route don't wok as i want it doesn't set Cookie
const GoogleRouteHandler: AppRouteHandler<typeof GoogleRoute> = async (c) => {
const controller = new AuthenticationController();
const { state, code, url } = await controller.createGoogleAuthorizationURL();
setCookie(c, "googleOAuthVerifier", code, {
expires: new Date(Date.now() + 1000 * 60 * 10),
httpOnly: true,
sameSite: "lax",
secure: process.env.NODE_ENV === "production",
});
setCookie(c, "googleOAuthState", state, {
expires: new Date(Date.now() + 1000 * 60 * 10),
httpOnly: true,
sameSite: "lax",
secure: process.env.NODE_ENV === "production",
});
return c.redirect(url.toString(), 301);
};
const GoogleRouteHandler: AppRouteHandler<typeof GoogleRoute> = async (c) => {
const controller = new AuthenticationController();
const { state, code, url } = await controller.createGoogleAuthorizationURL();
setCookie(c, "googleOAuthVerifier", code, {
expires: new Date(Date.now() + 1000 * 60 * 10),
httpOnly: true,
sameSite: "lax",
secure: process.env.NODE_ENV === "production",
});
setCookie(c, "googleOAuthState", state, {
expires: new Date(Date.now() + 1000 * 60 * 10),
httpOnly: true,
sameSite: "lax",
secure: process.env.NODE_ENV === "production",
});
return c.redirect(url.toString(), 301);
};
1 replies