Email Verification
How email verification works and how to configure it.
How It Works
When a user registers, they receive a verification email. Until verified, access to protected routes is restricted by the EmailVerifiedGuard component.
Verification Flow
- User registers → verification email sent automatically
- Email contains a verification link with a unique token
- User clicks link → token validated → email marked as verified
EmailVerifiedGuardallows access to protected content
Resend Verification
Users can request a new verification email from the /verify-email page. The API endpoint is:
POST /api/auth/resend-verificationDisabling Verification
To disable email verification (not recommended for production):
// lib/auth.ts
emailAndPassword: {
enabled: true,
requireEmailVerification: false, // disable
}And remove EmailVerifiedGuard from app/[locale]/(protected)/layout.tsx.