Example Docs

Authentication

Better Auth supports multiple authentication methods out of the box. You can enable one or many, and they all work together seamlessly.

Available Methods

MethodBuilt-inPlugin Required
Email & Password
Social Sign-on (OAuth)
Magic Linkmagic-link
Passkeys (WebAuthn)passkey
Phone / SMSphone-number
Anonymous Authanonymous

Email & Password

The most common authentication method. Enable it in your auth config:

export const auth = betterAuth({
  emailAndPassword: {
    enabled: true,
    requireEmailVerification: true, // Optional
    minPasswordLength: 8, // Default: 8
    maxPasswordLength: 128, // Default: 128
  },
});

Password Hashing

Better Auth uses Argon2id by default for password hashing — the most secure algorithm recommended by OWASP. You can also use bcrypt or scrypt:

export const auth = betterAuth({
  emailAndPassword: {
    enabled: true,
    password: {
      hash: "bcrypt", // "argon2" | "bcrypt" | "scrypt"
      saltRounds: 12, // For bcrypt
    },
  },
});

Social Sign-on

See Social Sign-on for detailed provider setup.

Choosing a Method


Deep Dives