feat: protect api routes and fetch user data from /api/profile

This commit is contained in:
Riccardo
2024-06-26 14:28:11 +02:00
parent d052cbef4c
commit 571ab92273
4 changed files with 35 additions and 19 deletions

11
app/api/profile/route.ts Normal file
View File

@@ -0,0 +1,11 @@
import { NextResponse } from 'next/server';
import { getSession, withApiAuthRequired } from '@auth0/nextjs-auth0';
const GET = withApiAuthRequired(async () => {
const session = await getSession();
return NextResponse.json(session?.user);
});
export { GET };