Better Auth is a framework-agnostic authentication and authorization library for TypeScript. It runs inside your own application rather than behind a hosted dashboard: configuration is declarative code, checked into the repository and reviewable in pull requests, and it connects to a database you provide. Sessions, email and password credentials, email verification, and password reset are built in, alongside social sign-in with providers such as Google, GitHub, Apple, and Discord.
Capabilities beyond the basics come from a plugin ecosystem, so features are added by listing plugins in the configuration object. Plugins cover second factors and passwordless sign-in (two-factor authentication, passkeys, magic links, email one-time passwords, phone number, anonymous, bearer, and one-time token), multi-tenancy (organizations, teams, roles, invitations, and access control), enterprise identity (single sign-on, SAML 2.0, SCIM directory sync), and API keys and JSON Web Tokens.
Agent-facing authentication is part of the same surface: MCP authentication, token exchange, and agent delegation scope an agent identity and its capabilities. Operational plugins add bot detection, IP blocking, email validation, and administration of users, sessions, and organizations. It integrates with Next.js, Nuxt, SvelteKit, Astro, Hono, and other TypeScript frameworks.
Features
- Framework-agnostic: one library across Next.js, Nuxt, SvelteKit, Astro, Hono, and other TypeScript stacks
- Credential auth built in: sessions, email verification, and password reset without extra packages
- Social providers: Google, GitHub, Apple, Discord, and generic OAuth
- Plugin ecosystem: two-factor, passkeys, magic links, email OTP, username, phone number, anonymous, bearer, and one-time token sign-in
- Multi-tenancy: organizations, teams, roles, invitations, and access control
- Enterprise identity: single sign-on, SAML 2.0, and SCIM directory sync
- Agent auth: MCP authentication, token exchange, and agent delegation for scoping agent identities
- Security and observability: bot detection, IP blocking, email validation, and user, session, and organization management
- Your own database: the data layer is supplied by you rather than by a hosted service
