# Email Verification

> Configure email verification for new users. Send verification emails on signup, require confirmation before login, and handle resends via the SDK.

When enabled, new users receive a verification email after registration. They cannot log in until their email is confirmed.

## Enable verification

In your project's auth settings (dashboard → Auth → Configuration), toggle **Require email verification**. Once enabled, `signUp` returns `requiresVerification: true` and no token is issued.

## Handle in your app

```tsx

function RegisterFlow() {
  const { signUp } = useAuth()
  const [needsVerification, setNeedsVerification] = useState(false)

  const handleRegister = async () => {
    const result = await signUp(email, password, { name })
    if (result.requiresVerification) {
      setNeedsVerification(true)
    }
  }

  if (needsVerification) {
    return 
  }
  // ...
}
```

## Verify from email link

The verification link in the email points to your app with a `?token=` query param. Handle it:

```tsx
// In your /verify-email page

function VerifyEmailPage() {
  const { verifyEmail } = useAuth()
  const [params] = useSearchParams()

  useEffect(() => {
    const token = params.get('token')
    if (token) {
      verifyEmail(token).then(() => {
        // Email verified — redirect to app
      })
    }
  }, [])
}
```

```bash
GET /v1/public/projects/{slug}/auth/verify-email?token={token}

# Response: 200 OK
{ "message": "Email verified successfully" }
```

## Resend verification email

```tsx
const { resendVerificationEmail } = useAuth()

await resendVerificationEmail('user@example.com')
```

Resend is rate-limited to prevent abuse. If the user does not receive the email, check your spam folder or contact support.

## Configure the verification email

The verification email template (sender name, subject, body) is configurable in your project dashboard under **Auth → Email Templates**.
