Better Auth

better-auth.com
Developer Tools

The most comprehensive authentication library for TypeScript.

llms.txt

Better Auth

The most comprehensive authentication framework for TypeScript

Table of Contents

Adapters

Ai Resources

  • AI Resources: Ask AI in the docs, LLMs.txt, the documentation MCP server, and Better Auth skills for coding assistants.
  • MCP: Connect Better Auth documentation to MCP-capable clients via the remote documentation MCP server.
  • Skills: Install Better Auth agent skills so your coding assistant follows library conventions and patterns.

Authentication

  • Apple: Apple provider setup and usage.
  • Atlassian: Atlassian provider setup and usage.
  • Cognito: Amazon Cognito provider setup and usage.
  • Discord: Discord provider setup and usage.
  • Dropbox: Dropbox provider setup and usage.
  • Email & Password: Implementing email and password authentication with Better Auth.
  • Facebook: Facebook provider setup and usage.
  • Figma: Figma provider setup and usage.
  • GitHub: GitHub provider setup and usage.
  • GitLab: GitLab provider setup and usage.
  • Google: Google provider setup and usage.
  • Hugging Face: Hugging Face provider setup and usage.
  • Kakao: Kakao provider setup and usage.
  • Kick: Kick provider setup and usage.
  • LINE: LINE provider setup and usage.
  • Linear: Linear provider setup and usage.
  • LinkedIn: LinkedIn Provider
  • Microsoft: Microsoft provider setup and usage.
  • Naver: Naver provider setup and usage.
  • Notion: Notion provider setup and usage.
  • Other Social Providers: Other social providers setup and usage.
  • Paybin: Paybin provider setup and usage.
  • PayPal: Paypal provider setup and usage.
  • Polar: Polar provider setup and usage.
  • Railway: Railway provider setup and usage.
  • Reddit: Reddit provider setup and usage.
  • Roblox: Roblox provider setup and usage.
  • Salesforce: Salesforce provider setup and usage.
  • Slack: Slack provider setup and usage.
  • Spotify: Spotify provider setup and usage.
  • TikTok: TikTok provider setup and usage.
  • Twitch: Twitch provider setup and usage.
  • Twitter (X): Twitter provider setup and usage.
  • Vercel: Vercel provider setup and usage.
  • VK: VK ID Provider
  • WeChat: WeChat provider setup and usage.
  • Zoom: Zoom provider setup and usage.

Basic Usage

Comparison

  • Comparison: Comparison of Better Auth versus over other auth libraries and services.

Concepts

  • API: Learn how to call Better Auth API endpoints on the server, pass body, headers, and query parameters, retrieve response headers, and handle errors.
  • CLI: Learn about the Better Auth CLI commands for generating and migrating database schemas, initializing projects, generating secret keys, and gathering diagnostic info.
  • Client: Learn how to set up the Better Auth client for React, Vue, Svelte, and other frameworks, use hooks, configure fetch options, handle errors, and extend with client plugins.
  • Cookies: Learn how Better Auth uses cookies, including cookie prefixes, custom cookie attributes, cross-subdomain sharing, secure cookies, and handling Safari ITP with proxies.
  • Database: Learn about database adapters, migrations, secondary storage with Redis, core schema (user, session, account, verification), custom tables, extending schemas, ID generation, database hooks, and plugin schemas.
  • Email: Learn how to set up email verification, require verified emails for sign-in, auto sign-in after verification, handle post-verification callbacks, and implement password reset emails.
  • Hooks: Learn how to use before and after hooks to customize endpoint behavior, modify requests and responses, handle cookies, throw errors, access auth context, and run background tasks.
  • OAuth: Learn how to configure social OAuth providers, sign in and link accounts, request scopes, pass additional data, refresh access tokens, map profiles, and customize provider options.
  • Plugins: Learn how to use and create Better Auth plugins, including defining endpoints, schemas, hooks, middleware, rate limits, trusted origins, and building client plugins with custom actions and atoms.
  • Rate Limit: Learn how to configure rate limiting in Better Auth, including IP address detection, IPv6 support, custom rate limit windows, storage backends, error handling, and per-endpoint rules.
  • Session Management: Learn about session management in Better Auth, including session expiration, freshness, cookie caching strategies, secondary storage, stateless sessions, and customizing session responses.
  • TypeScript: Learn about TypeScript configuration for Better Auth, including strict mode, inferring types for sessions and users, defining additional fields, and inferring additional fields on the client.
  • User & Accounts: Learn how to manage users and accounts, including updating user info, changing emails and passwords, deleting users with verification, token encryption, and account linking and unlinking.

Examples

Guides

Infrastructure

  • Getting Started: This guide will help you integrate Better Auth Infrastructure into your application.
  • Better Auth Infrastructure: Enterprise-grade dashboard, security, and managed services for Better Auth.
  • Email Service: Better Auth Infrastructure provides a managed transactional email service with pre-built templates for common authentication flows. Send verification emails, password resets, invitations, and more without managing email infrastructure.
  • SMS Service: Better Auth Infrastructure provides a managed SMS service for sending OTP codes for phone verification and two-factor authentication. Send verification codes without managing SMS providers.
  • Audit Logs: Track and query authentication events across your application with automatic audit logging.
  • Dashboard Plugin (dash): The dash() plugin connects your Better Auth instance to Better Auth Infrastructure, enabling analytics tracking, event logging, and admin dashboard APIs.
  • Dashboard: The dash() plugin connects your Better Auth instance to Better Auth Infrastructure, enabling analytics tracking, activity monitoring, and admin dashboard APIs.
  • Security Plugin (sentinel): The sentinel() plugin provides comprehensive security and abuse protection for your authentication system. It detects and prevents various attack vectors including credential stuffing, impossible travel, free trial abuse, and more.

Installation

  • Installation: Learn how to configure Better Auth in your project.

Integrations

Introduction

Plugins

  • Two-Factor Authentication (2FA): Enhance your app's security with two-factor authentication.
  • Admin: Admin plugin for Better Auth
  • Agent Auth: Agent identity, registration, discovery, and capability-based authorization for AI agents.
  • Anonymous: Anonymous plugin for Better Auth.
  • Autumn Billing: Better Auth Plugin for Autumn Billing
  • Bearer Token Authentication: Authenticate API requests using Bearer tokens instead of browser cookies
  • Captcha: Captcha plugin
  • Chargebee: Chargebee plugin for Better Auth to manage subscriptions and payments.
  • Commet: Better Auth Plugin for Billing and Subscriptions using Commet
  • Community Plugins: Community-built plugins that extend Better Auth.
  • Creem: Better Auth Plugin for Payment and Subscriptions using Creem
  • Device Authorization: OAuth 2.0 Device Authorization Grant for limited-input devices
  • Dodo Payments: Better Auth Plugin for Dodo Payments
  • Dub: Better Auth Plugin for Lead Tracking using Dub links and OAuth Linking
  • Email OTP: Email OTP plugin for Better Auth.
  • Generic OAuth: Authenticate users with any OAuth provider
  • Have I Been Pwned: A plugin to check if a password has been compromised
  • i18n: Internationalization plugin for translating error messages
  • Plugins: Browse all Better Auth plugins — authentication, authorization, payments, security, and more.
  • JWT: Authenticate users with JWT tokens in services that can't use the session
  • Last Login Method: Track and display the last authentication method used by users
  • Magic link: Magic link plugin
  • MCP: MCP provider plugin for Better Auth
  • Multi Session: Learn how to use multi-session plugin in Better Auth.
  • OAuth 2.1 Provider: A Better Auth plugin that enables your auth server to serve as an OAuth 2.1 provider.
  • OAuth Proxy: OAuth Proxy plugin for Better Auth
  • OIDC Provider: Open ID Connect plugin for Better Auth that allows you to have your own OIDC provider.
  • One Tap: One Tap plugin for Better Auth
  • One-Time Token Plugin: Generate and verify single-use token
  • Open API: Open API reference for Better Auth.
  • Organization: The organization plugin allows you to manage your organization's members and teams.
  • Passkey: Passkey
  • Phone Number: Phone number plugin
  • Polar: Better Auth Plugin for Payment and Checkouts using Polar
  • System for Cross-domain Identity Management (SCIM): Integrate SCIM with your application.
  • Sign In With Ethereum (SIWE): Sign in with Ethereum plugin for Better Auth
  • Single Sign-On (SSO): Integrate Single Sign-On (SSO) with your application.
  • Stripe: Stripe plugin for Better Auth to manage subscriptions and payments.
  • Test Utils: Testing utilities for integration and E2E testing
  • Username: Username plugin
  • Advanced Features: Advanced API Key features including sessions, multiple configurations, organization keys, storage modes, and more.
  • API Key: API Key plugin for Better Auth.
  • Reference: API Key plugin options, permissions, and schema reference.

Reference

Related

The AI Toolkit for TypeScript, from the creators of Next.js.

/llms.txt
136,985 tokens
Developer Tools

Meet the modern standard for public facing documentation. Beautiful out of the box, easy to maintain, and optimized for user engagement.

/llms.txt
5,436 tokens
/llms-full.txt
181,290 tokens
Developer Tools

Web development for the rest of us.

/llms.txt
602 tokens
/llms-full.txt
453,623 tokens
Developer Tools

Search through billions of items for similar matches to any object, in milliseconds. It’s the next generation of search, an API call away.

/llms.txt
15,715 tokens
/llms-full.txt
588,629 tokens
Developer Tools

Build and deploy reliable background jobs with no timeouts and no infrastructure to manage.

/llms.txt
12,202 tokens
/llms-full.txt
387,586 tokens
Developer Tools

Get the simple developer experience of SQLite in production, and scale your multi-tenant backend with unlimited databases.

/llms.txt
10,006 tokens
/llms-full.txt
163,317 tokens
Developer Tools

Upstash is a serverless data platform providing low latency and high scalability for real-time applications.

/llms.txt
52,307 tokens
/llms-full.txt
1,200,134 tokens
Developer Tools

One-click deployments built for teams, tuned for Laravel, loaded with tools and goodies you're going to love.

/llms.txt
565 tokens
/llms-full.txt
11,330 tokens
Developer Tools