Authentication

Learn how to use our comprehensive authentication system powered by Better Auth.

Better Auth Overview

Modern Authentication Framework

Better Auth provides a complete authentication solution with support for multiple providers

Key Features

  • • Multiple authentication providers
  • • Session management
  • • Two-factor authentication
  • • Password reset & email verification
  • • Organization/team management
  • • Passkeys (WebAuthn)

Security Features

  • • Rate limiting built-in
  • • CSRF protection
  • • Secure session cookies
  • • OAuth state management
  • • Email verification flows
  • • Multi-session support

Social Providers

Supported OAuth Providers

Configure social login providers for seamless user authentication

Google OAuth

Enable Google authentication with just a few environment variables.

Required Variables
GOOGLE_CLIENT_ID
GOOGLE_CLIENT_SECRET

Email & Password Authentication

Traditional Authentication

Email and password authentication with security best practices

Features

Secure
Bcrypt password hashing
Verification
Email verification required
Reset
Password reset flows

Email Configuration

Configure email delivery using Resend:

RESEND_API_KEY - Your Resend API key
BETTER_AUTH_EMAIL - Sender email address

Two-Factor Authentication

Enhanced Security

Protect accounts with two-factor authentication using email OTP

How It Works

  1. 1. User enables 2FA in their security settings
  2. 2. During login, user enters email and password
  3. 3. System sends OTP code to user's email
  4. 4. User enters OTP to complete authentication

Implementation

2FA is automatically configured when you set up email delivery. Users can enable/disable it from their security settings.

Session Management

Secure Sessions

Manage user sessions with security and flexibility

Session Features

Secure
HTTP-only cookies
Multi-session
Support multiple active sessions
Revocation
Revoke specific sessions

Accessing Sessions

Server Components:

auth.api.getSession(headers)

Client Components:

useSession() hook