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

14
middleware.ts Normal file
View File

@@ -0,0 +1,14 @@
import { withMiddlewareAuthRequired } from '@auth0/nextjs-auth0/edge';
import { NextResponse } from 'next/server';
export default withMiddlewareAuthRequired({
async middleware() {
const res = NextResponse.next();
return res;
},
returnTo: '/api/auth/login'
});
export const config = {
matcher: ['/api/protected/:path*', '/customer-form/:path*']
};