feat: add auth0 middleware

This commit is contained in:
Riccardo
2024-07-08 11:49:46 +02:00
parent 4aa1ef8463
commit 19d00d5153
7 changed files with 65 additions and 44 deletions

View File

@@ -1,12 +1,12 @@
import { NextResponse } from 'next/server';
import { getSession, withApiAuthRequired } from '@auth0/nextjs-auth0';
import { getSession } from '@auth0/nextjs-auth0';
export const GET = withApiAuthRequired(async () => {
export async function GET() {
const session = await getSession();
return NextResponse.json({
success: true,
data: { email: session?.user.email }
});
});
}