Skip to main content
General
Authentication

Overview

Learn more about authentication in the starter kit.

Open MarkdownFull AI corpusFeedback

Authentication is a core part of any SaaS application. The Pro Next.js Drizzle starter kit uses Better Auth to handle authentication and provides all the necessary UI for the authentication flow.

The starter kit comes with pre-configured providers, helper methods and extensions.

Included authentication flows

  • Email and password registration with email verification
  • Password reset and email-address changes
  • Google OAuth and trusted account linking
  • Database-backed sessions with device revocation
  • TOTP two-factor authentication with failed-attempt lockout
  • Organization invitations and active-organization sessions
  • Administrator bans and impersonation

Two-factor authentication

Users with a credential account can enroll an authenticator app from Dashboard → Settings → Security. Enrollment requires the current password, then a valid six-digit TOTP code. After enrollment, password sign-in redirects to /auth/verify until the TOTP challenge succeeds.

Better Auth stores TOTP secrets and backup codes in the two_factor table. The current schema also tracks whether setup was verified, failed verification attempts and the lockout expiry. Apply committed database migrations when upgrading Better Auth so these security fields exist before deploying the new application code.