To upgrade, run:
npm pnpm yarn bun
npm install better-auth@1.2
Stripe integration for customer management, subscriptions, and webhooks.
npm pnpm yarn bun
npm install @better-auth/stripe
import { stripe } from "@better-auth/stripe" ;
export const auth = betterAuth ({
plugins: [
stripe ({
createCustomerOnSignup: true ,
subscription: {
enabled: true ,
plans: [
{
name: "pro" ,
priceId: "price_1234567890" ,
},
],
},
}),
],
});
Read the Stripe Plugin docs for more information.
Protect your authentication flows with Google reCAPTCHA and Cloudflare Turnstile. Works for signup, signin, and password resets.
import { captcha } from "better-auth/plugins" ;
const auth = betterAuth ({
plugins: [
captcha ({
provider: "cloudflare-turnstile" , // or "google-recaptcha" //
secretKey: process.env. TURNSTILE_SECRET_KEY ! ,
}),
],
});
Read the Captcha Plugin docs for more information.
Generate and manage API keys with rate limiting, expiration, and metadata. Supports session creation from API keys.
import { apiKey } from "better-auth/plugins" ;
const auth = betterAuth ({
plugins: [ apiKey ()],
});
Read the API Key Plugin docs for more information.
Organizations can now have teams or sub-organizations under them.
const auth = betterAuth ({
plugins: [
organization ({
teams: {
enabled: true ,
},
}),
],
});
Read the Organization Plugin docs for more information.
The CLI now includes an init
command to add better auth to your project.
npx @better-auth/cli init
Added displayName
for case-insensitive lookups while preserving original formatting.
Built-in validation.
If you're using the Username plugin, make sure to add the displayName
field
to your schema.
Multiple Roles per User – Assign more than one role to a user.
Manage roles and permissions within the admin plugin. Learn more
adminUserIds
option to grant specific users admin privileges. Learn more
Auto Cleanup for expired verification data
Improved Google One Tap integration with JWT verification and enhanced prompt handling
Phone-based Password Reset functionality
Provider Control Options :
Disable signups for specific providers
Disable implicit signups for specific providers
Control default scopes and allow custom scopes on request
Enhanced Database Hooks with additional context information
We rewrote better-call (the core library behind Better Auth) to fix TypeScript editor lag. Your IDE should now feel much snappier when working with Better Auth.
The CLI now includes an init
command to speed up setup:
Scaffold new projects
Generate schemas
Run migrations
Learn more
A lot of fixes and refinements to make everything smoother, faster, and more reliable. Check out the changelog for more details.
npm pnpm yarn bun
npm install better-auth@1.2.0
Upgrade now and take advantage of these powerful new features! 🚀