掌控你的身份验证

最全面的身份验证框架,专为 Web

README

Better Auth 是一个认证框架。它开箱即用地提供完整的功能集,并拥有插件生态,能更轻松地扩展高级能力和基础设施,帮助你在大规模场景下掌控自己的认证系统。

npx auth init
受到信赖
OpenAI
databricks
strapi
OpenAI
databricks
strapi
特性
01框架无关
适配你的技术栈。
对 Next.js、Nuxt、SvelteKit、Astro、Hono、Express 等 20 多种框架提供一流支持。
+14
02邮箱和密码
内置凭证认证。
开箱即用支持会话管理、邮箱验证和密码重置。
user@email.com
••••••••
03社交登录
40+ 社交提供商。
Google、GitHub、Apple、Discord、Microsoft 等主流平台,几行配置即可接入。
Sign in with Google
+34
04组织
内置多租户能力。
支持团队、角色、邀请和成员管理,并提供细粒度访问控制。
A
B
C
+
owneradminmember
05企业级
SSO、SAML 与 SCIM。
为 B2B 产品提供企业级 SSO、SAML 2.0、SCIM 预配与目录同步。
+
06插件
50+ 并持续增长。
涵盖 Passkey、魔法链接、匿名认证、API 密钥、JWT 以及社区生态。
passkeys2famagic-linkjwtapi-keysanonymousoidcotpbearermulti-session
07Agent 认证
为 AI Agent 提供认证。
支持 MCP 服务器认证、异步认证流程、令牌交换以及 Agent 间委托。
$agent.auth()sk-••••
08基础设施托管
安全与可观测性。
覆盖机器人检测、实时行为分析、IP 封锁、邮箱校验等能力。
blocked
challenged
allowed
09控制台托管
用户管理。
管理用户、会话和组织,并跟踪注册、活跃用户与增长情况。
10:50 AMJohncreated a session
10:48 AMSarahupdated profile
10:45 AMAlexjoined organization
10:42 AMEmmarevoked token
10:38 AMMikeenabled 2FA
10:50 AMJohncreated a session
10:48 AMSarahupdated profile
10:45 AMAlexjoined organization
10:42 AMEmmarevoked token
10:38 AMMikeenabled 2FA
Declarative Config
import { betterAuth } from "better-auth"export const auth = betterAuth({  emailAndPassword: {    enabled: true,  },  socialProviders: {    google: {      clientId: process.env.GOOGLE_CLIENT_ID!,      clientSecret: process.env.GOOGLE_CLIENT_SECRET!,    },    github: {      clientId: process.env.GITHUB_CLIENT_ID!,      clientSecret: process.env.GITHUB_CLIENT_SECRET!,    },  },  plugins: [    twoFactor(),    passkey(),    organization(),  ],})
带上你自己的 数据库

使用任何你想要的数据库。可以直接通过连接字符串连接,或者使用你喜欢的 ORM 适配器。你的数据会保留在你的数据库中。

import { betterAuth } from "better-auth"import { Pool } from "pg"export const auth = betterAuth({  database: new Pool({    connectionString: process.env.DATABASE_URL,  }),})
AI Native

Your auth lives in your codebase — so AI can configure it. Ships with MCP server, Claude Code skills, and Cursor rules.

Add Google login and 2FA to my app
mcpConnected to better-auth docs
skillbetter-auth/add-provider → google
skillbetter-auth/add-plugin → two-factor
writelib/auth.ts+14
doneGoogle OAuth + 2FA configured

Cursor

npx @better-auth/cli mcp --cursor

Claude Code

claude mcp add better-auth

Open Code

npx @better-auth/cli mcp --open-code
OAuth Providers
35+

social providers

GoogleGitHubAppleMicrosoftDiscord
SlackTwitterFacebookLinkedInGitLab
TwitchSpotifyFigmaNotionAtlassian
SalesforceHuggingFaceRobloxRedditTikTok
PayPalDropboxZoomVercelLinear
KickKakaoLineVKNaver
Plugin Ecosystem33 official
browse all →
Two FactorAuthenticationPasskeyAuthenticationMagic LinkAuthenticationEmail OTPAuthenticationUsernameAuthenticationOne TapAuthenticationPhone NumberAuthenticationAnonymousAuthenticationBearerAuthenticationGeneric OAuthAuthenticationOne Time TokenAuthenticationSIWEAuthenticationOrganizationOrganizationAdminOrganizationMulti SessionOrganizationAPI KeyOrganizationSSOEnterpriseTwo FactorAuthenticationPasskeyAuthenticationMagic LinkAuthenticationEmail OTPAuthenticationUsernameAuthenticationOne TapAuthenticationPhone NumberAuthenticationAnonymousAuthenticationBearerAuthenticationGeneric OAuthAuthenticationOne Time TokenAuthenticationSIWEAuthenticationOrganizationOrganizationAdminOrganizationMulti SessionOrganizationAPI KeyOrganizationSSOEnterprise
OIDC ProviderEnterpriseSCIMEnterpriseOAuth ProxyEnterpriseJWTSecurityHIBPSecurityCaptchaSecurityStripeIntegrationPolarIntegrationOpen APIIntegrationDubIntegrationAutumnIntegrationDodo PaymentsIntegrationCreemIntegrationMCPAIDevice AuthAuthenticationLast LoginAuthenticationOIDC ProviderEnterpriseSCIMEnterpriseOAuth ProxyEnterpriseJWTSecurityHIBPSecurityCaptchaSecurityStripeIntegrationPolarIntegrationOpen APIIntegrationDubIntegrationAutumnIntegrationDodo PaymentsIntegrationCreemIntegrationMCPAIDevice AuthAuthenticationLast LoginAuthentication
Infrastructure

Managed infrastructure on top of the open-source framework.

User management and monitoring platform.

Monitor sign-ups, manage users, track sessions, and surface security insights — with an agentic Cmd+K to do it all in natural language.

dash.better-auth.com/the-next-big-thing
OverviewUsersOrgsEvents
User Management
CRUD, sessions, bans
Live Events
Real-time auth feed
Agent Dashboard
Cmd+K agentic UI
Security Insights
Actionable alerts

Audit Logs

Every auth event captured automatically — sign-ins, password resets, MFA challenges, session changes, and more. Filter, search, and export with configurable retention and log drain to your SIEM.

Auto Capture
Every auth event logged
Log Explorer
Filter & search events
Retention
1 day to custom
Log Drain
Export to your SIEM

Transactional Comms

Built-in email and SMS delivery for verification codes, magic links, password resets, and MFA. Customizable templates, abuse protection, and delivery tracking — no third-party setup required.

Email & SMS
Built-in delivery
Templates
Fully customizable
Abuse Protection
Rate limits & blocking
Delivery Tracking
Status & analytics
Sentinel

为你的应用提供安全基础设施。

机器人检测、暴力破解防护、临时邮箱拦截、地理位置限制等能力,都会在威胁触达用户之前实时生效。

Sentinel监控并分析安全事件
操作标识原因路径时间
已拦截
akash.prish@dropmeon.com::1
临时邮箱/sign-up/email2 分钟前
已拦截
kamef69609@cucadas.comUnknown IP
临时邮箱/sign-up/email4 分钟前
已质询
195.142.xx.xx
可疑 IP/sign-in7 分钟前
已拦截
bot-crawler-7x52.14.xx.xx
检测到机器人/api/auth12 分钟前
已拦截
admin@tempmail.ninja::1
泄露密码/sign-up/email18 分钟前
机器人检测暴力破解泄露密码异常异地登录限流地域封锁可疑 IP临时邮箱邮箱滥用试用滥用沉寂用户

Explore plans

Dashboard, audit logs, security detection, transactional comms, and more.

View Plans
贡献者

由超过 746+ 位贡献者共同打造。

几分钟内,自信构建属于你自己的认证系统。

© 2026 Better Auth Inc.
|