- 로그인 폼 생성
// /app/login/page.tsx
- 임시 인증키 발급
npx auth secret #임시 인증키 발급
- 페이지옵션 추가
// /auth.config.ts
import type { NextAuthConfig } from 'next-auth';
export const authConfig = {
pages: {
signIn: '/login',
},
};
- 미들웨어 추가
// /middleware.ts
import NextAuth from 'next-auth';
import { authConfig } from './auth.config';
export default NextAuth(authConfig).auth;
export const config = {
// https://nextjs.org/docs/app/building-your-application/routing/middleware#matcher
matcher: ['/((?!api|_next/static|_next/image|.*\\.png$).*)'],
};
- 비밀번호 해싱