Add authenticated login and SSO protection
This commit is contained in:
16
app/api/auth/me/route.ts
Normal file
16
app/api/auth/me/route.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { getAuthRuntimeConfig } from "@/lib/auth/config";
|
||||
import { jsonOk } from "@/lib/server/api";
|
||||
import { getOptionalAuthSession } from "@/lib/server/auth/current-user";
|
||||
|
||||
export const runtime = "nodejs";
|
||||
|
||||
export async function GET() {
|
||||
const config = getAuthRuntimeConfig();
|
||||
const session = await getOptionalAuthSession();
|
||||
return jsonOk({
|
||||
authenticated: Boolean(session),
|
||||
authRequired: config.required,
|
||||
authConfigured: config.configured,
|
||||
user: session?.user || null
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user