fix(auth): correct local cookie security configuration

This commit is contained in:
Schubert Ferenc 2026-07-11 15:50:15 +02:00
parent b584e60273
commit 155fdbb16a
67 changed files with 1003 additions and 62 deletions

View file

@ -0,0 +1,18 @@
import { cookies } from "next/headers";
import { NextResponse } from "next/server";
import { AUTH_COOKIE_NAME } from "@/lib/auth";
const mercuryBase = `${process.env.MERCURY_INTERNAL_URL ?? "http://mercury-api:8000"}/api/v1`;
export async function GET() {
const cookieStore = await cookies();
const token = cookieStore.get(AUTH_COOKIE_NAME)?.value;
if (!token) {
return NextResponse.json({ detail: "Not authenticated" }, { status: 401 });
}
const response = await fetch(`${mercuryBase}/auth/me`, {
headers: { Authorization: `Bearer ${token}` }
});
const data = await response.json();
return NextResponse.json(data, { status: response.status });
}