* add csrf endpoint * Update booking-pages.e2e.ts * Update zod-utils.ts * fix type error
18 lines
397 B
TypeScript
18 lines
397 B
TypeScript
import { randomBytes } from "crypto";
|
|
import { NextResponse } from "next/server";
|
|
|
|
export async function GET() {
|
|
const token = randomBytes(32).toString("hex");
|
|
|
|
const res = NextResponse.json({ csrfToken: token });
|
|
|
|
res.cookies.set("calcom.csrf_token", token, {
|
|
httpOnly: true,
|
|
secure: process.env.NODE_ENV === "production",
|
|
sameSite: "lax",
|
|
path: "/",
|
|
});
|
|
|
|
return res;
|
|
}
|