skills.vishalvoidskills/vishalvoid
Technical & DevelopmentAdvanced

two-factor-authentication-best-practices

Configure TOTP authenticator apps, send OTP codes via email/SMS, manage backup codes, handle trusted devices, and implement 2FA sign-in flows using Better Auth's twoFactor plugin.

Developer Setup

Setup & Installation

bash
npx skills add https://github.com/better-auth/skills --skill two-factor-authentication-best-practices

Overview

What This Skill Does

Integrates multi-factor authentication (MFA) using TOTP (authenticator apps like Google Authenticator or 1Password) or OTP (sent via email/SMS), along with backup codes and trusted device tracking.

Application

When to use this Skill

Documentation

Show Skills.md file

Better Auth Two-Factor Authentication

Setup

  1. Add twoFactor() plugin to server config with issuer
  2. Add twoFactorClient() plugin to client config
  3. Run npx @better-auth/cli migrate
  4. Verify: check that twoFactorSecret column exists on user table
import { betterAuth } from "better-auth";
import { twoFactor } from "better-auth/plugins";

export const auth = betterAuth({
  appName: "My App",
  plugins: [
    twoFactor({
      issuer: "My App",
    }),
  ],
});

Client-Side Setup

Lines 1 - 25 of 100

Recommendations

Explore other random skills

All skillsMy patterns