feat(api): add auth check to ai-summary endpoint

Require authentication for ai-summary endpoint to prevent
unauthorized API key usage and cost leakage.
This commit is contained in:
2026-04-06 23:18:46 -04:00
parent 4c6f880a3f
commit c3026c8262

View File

@@ -1,6 +1,19 @@
import { NextResponse } from "next/server";
import { auth } from "@/auth";
import { headers } from "next/headers";
export async function POST(request: Request) {
const session = await auth.api.getSession({
headers: await headers(),
});
if (!session?.user) {
return NextResponse.json(
{ error: "Authentication required" },
{ status: 401 },
);
}
try {
const { events } = await request.json();