fix: pass original request headers to auth.api.getSession

This commit is contained in:
Christopher Mayor
2026-04-27 12:05:50 -07:00
parent 419d96aedc
commit 8f64ccd2f6
2 changed files with 3 additions and 15 deletions

View File

@@ -24,12 +24,7 @@ function slugify(text: string): string {
// const ratelimit = new Ratelimit({ redis, limiter: slidingWindow(5, "1m") })
export async function POST(request: Request) {
// Use a plain Headers object to avoid any Request-header quirks
const headers = new Headers();
const cookie = request.headers.get("cookie");
if (cookie) headers.set("cookie", cookie);
const session = await auth.api.getSession({ headers });
const session = await auth.api.getSession({ headers: request.headers });
if (!session?.user) {
return Response.json({ error: "Authentication required" }, { status: 401 });
}