Next14 버전은 현재 호환성 문제 있음 (24.06.13 기준)
npm install next-auth@beta
import NextAuth from 'next-auth';
export const { handlers, signIn, signOut, auth } = NextAuth({
providers: [],
});
import { handlers } from '@/auth'; // Referring to the auth.ts we just created
export const { GET, POST } = handlers;
export { auth as middleware } from '@/auth';
import { NextRequest, NextResponse } from 'next/server';
export const config = {
matcher: ['/((?!api|_next/static|_next/image|favicon.ico).*)'],
};
export async function middleware(request: NextRequest) {
return NextResponse.next();
}