two-factor-authentication-best-practices

Configure TOTP, OTP delivery, backup codes, and trusted devices via Better Auth's twoFactor plugin.

Updated Feb 24, 2026
One-click install
npx skills add https://github.com/bartolomeomueller/hr --skill two-factor-authentication-best-practices-bartolomeomueller
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: two-factor-authentication-best-practices
Source: https://github.com/bartolomeomueller/hr/tree/main/.agents/skills/two-factor-authentication-best-practices
Command: npx skills add https://github.com/bartolomeomueller/hr --skill two-factor-authentication-best-practices-bartolomeomueller

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Configure 2FA best practices to harden account security by requiring a second factor during sign-in and providing a streamlined user experience.

Core Features & Use Cases

  • TOTP authenticator setup for mobile apps (QR setup, secret management)
  • OTP delivery via email/SMS with configurable delivery options
  • Backup codes generation, display, and regeneration for account recovery
  • Management of trusted devices with configurable trust durations
  • Clear sign-in flow guidance for enabling, verifying, and disabling 2FA

Quick Start

Install and enable the twoFactor plugin in your Better Auth config to enable 2FA for users.

Frequently Asked Questions about two-factor-authentication-best-practices

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up TOTP two-factor authentication for a web app?

Set up TOTP two-factor authentication by installing and enabling the twoFactor plugin in your Better Auth configuration. This enables QR code setup and secret management for mobile authenticator apps during user sign-in flows.

What is the best way to handle backup codes for multi-factor authentication?

The best way to handle backup codes for multi-factor authentication is using the twoFactor plugin to generate, display, and regenerate recovery codes. This ensures users can regain account access if they lose their primary OTP device.

Can I deliver OTP codes via email and SMS for sign-in security?

Yes, you can deliver OTP codes via email and SMS for sign-in security. The twoFactor plugin provides configurable delivery options to send one-time passwords through these channels during the multi-factor authentication verification process.

How does trusted device management work for two-factor authentication?

Trusted device management for two-factor authentication works by allowing the twoFactor plugin to configure trust durations for specific devices. This lets users skip repeated OTP prompts on recognized devices while maintaining session security.

Does Better Auth support disabling and verifying 2FA lifecycle controls?

Yes, Better Auth supports disabling and verifying 2FA lifecycle controls through its twoFactor plugin. It provides clear sign-in flow guidance for enabling, verifying, and disabling multi-factor authentication based on user account states.