feat(01-02): configure NextAuth.js v4 with credentials provider and JWT
- Install next-auth@4, bcryptjs, @types/bcryptjs, @types/jest - src/types/next-auth.d.ts: extend Session/JWT with tenantId, roles, isSuperAdmin - src/lib/auth-options.ts: CredentialsProvider + JWT/session callbacks, 24h maxAge - src/lib/auth.ts: getServerSession() and getCurrentUser() server helpers - src/app/api/auth/[...nextauth]/route.ts: NextAuth GET/POST handler - src/middleware.ts: withAuth middleware protecting all routes except /login /signup /api/auth/*
This commit is contained in:
6
src/app/api/auth/[...nextauth]/route.ts
Normal file
6
src/app/api/auth/[...nextauth]/route.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import NextAuth from "next-auth";
|
||||
import { authOptions } from "@/lib/auth-options";
|
||||
|
||||
const handler = NextAuth(authOptions);
|
||||
|
||||
export { handler as GET, handler as POST };
|
||||
Reference in New Issue
Block a user