Back to skills

twoFactor

security

Adds two-factor authentication to Better Auth apps via TOTP authenticator apps, email/SMS OTP codes, and backup codes. Handles the full 2FA lifecycle: enabling, verifying during sign-in, trusting devi

Setup & Installation

npx skills add https://github.com/better-auth/twoFactor --skill twoFactor
or paste the link and ask your coding assistant to install it
https://github.com/better-auth/twoFactor
View on GitHub

What This Skill Does

Adds two-factor authentication to Better Auth apps via TOTP authenticator apps, email/SMS OTP codes, and backup codes. Handles the full 2FA lifecycle: enabling, verifying during sign-in, trusting devices, and disabling. Backup codes, TOTP secrets, and OTP tokens can each be stored encrypted at rest. Implementing 2FA from scratch means writing your own TOTP logic, OTP delivery, backup code generation, trusted device cookies, and rate limiting — this plugin handles all of it as a single Better Auth configuration block.

When to use it

  • Working with twoFactor functionality
  • Implementing twoFactor features
  • Debugging twoFactor related issues