Files
archived-next-auth/apps/dev/nextjs/app/api/protected/route.ts
Balázs Orbán 23ea9428e0 update dev app
2023-04-13 14:43:25 +02:00

11 lines
259 B
TypeScript

import { auth } from "auth"
import { NextResponse } from "next/server"
export const GET = auth(function GET(req) {
if (req.auth) {
return NextResponse.json(req.auth)
}
return NextResponse.json({ message: "Not authenticated" }, { status: 401 })
})