Add auth guards to search and discover API routes

This commit is contained in:
2026-03-03 11:13:14 -05:00
parent f6ee32ca1e
commit d5e985efd9
4 changed files with 22 additions and 2 deletions
+9
View File
@@ -1,9 +1,18 @@
import { headers } from "next/headers";
import { type NextRequest, NextResponse } from "next/server";
import { auth } from "@/lib/auth/server";
import { isTmdbConfigured } from "@/lib/config";
import { discover } from "@/lib/tmdb/client";
import { tmdbImageUrl } from "@/lib/tmdb/image";
export async function GET(req: NextRequest) {
const session = await auth.api.getSession({
headers: await headers(),
});
if (!session) {
return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
}
if (!isTmdbConfigured()) {
return NextResponse.json(
{