Build

Authentication

Sign-in methods, two-factor, passkeys and social login.

01Sign-in methods

Choose methods in features/auth/config.ts. The login UI and the auth server both read it.

features/auth/config.ts
export const authMethods = {
  password: true,
  magicLink: true,
  emailOtp: true,
  passkey: true,
  anonymous: false, // "Continue as guest"; guests can sign up later and keep their data
} as const;

02Social login

Google, GitHub and Apple turn on when their keys are set:

.env.local
GOOGLE_CLIENT_ID=...
GOOGLE_CLIENT_SECRET=...
GITHUB_CLIENT_ID=...
GITHUB_CLIENT_SECRET=...

Users can connect and disconnect providers from /dashboard/account; the last sign-in method can't be removed.

03Security

Two-factor uses an authenticator app with backup codes. Passkeys use WebAuthn. Auth routes are rate-limited in the database, sessions can be revoked from the account page, and BETTER_AUTH_URL must match the URL people use, or requests fail with "Invalid origin".