Skip to main content
Email and password authentication is built into Better Auth. Enable it with a single config option, then use the client methods to sign users up, sign them in, and manage passwords.
If you prefer username-based login, see the username plugin. It extends email/password auth with username support.

Enable email and password

Set emailAndPassword.enabled to true in your betterAuth config:
auth.ts

Sign up

Call signUp.email on the client with the user’s details:
sign-up.ts

Auto sign-in after sign-up

By default, users are automatically signed in after a successful sign-up. Disable this with autoSignIn: false:
auth.ts
When autoSignIn is false or requireEmailVerification is true, the sign-up endpoint returns a generic success response for existing emails to prevent email enumeration.

Sign in

Call signIn.email on the client:
sign-in.ts
Always call client methods from the client side. Never call them from the server.

Server-side sign-in

To authenticate a user on the server, use auth.api:
server.ts

Sign out

Call signOut on the client:
user-card.ts

Email verification

Provide a sendVerificationEmail function in your auth config. Better Auth calls it whenever a verification email needs to be sent:
auth.ts
Do not await the email sending call. Awaiting it can introduce timing attacks. On serverless platforms, use waitUntil to ensure the email is sent before the function exits.

Require email verification before sign-in

Set requireEmailVerification: true to block sign-in until the email is confirmed:
auth.ts
Handle the error on the client:
sign-in.ts

Trigger verification manually

resend-verification.ts

Password reset

Configure the server

Provide a sendResetPassword function in your emailAndPassword config:
auth.ts

Request a password reset

Call requestPasswordReset on the client with the user’s email:
forgot-password.ts
When the user clicks the link in the email they are redirected to redirectTo with a ?token=... query parameter. If the token is invalid or expired, the redirect includes ?error=INVALID_TOKEN.

Reset the password

On your reset password page, read the token from the URL and call resetPassword:
reset-password.ts

Change password (authenticated)

Authenticated users can change their password directly:
change-password.ts

Configuration reference