two-factor-authentication-best-practices

Implements secure 2FA with TOTP, OTP, backup codes, and trusted devices using Better Auth.

1|Updated Mar 6, 2026
One-click install
npx skills add https://github.com/UmarSidiki/whatsapp-assistant --skill two-factor-authentication-best-practices-umarsidiki
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: two-factor-authentication-best-practices
Source: https://github.com/UmarSidiki/whatsapp-assistant/tree/main/.agents/skills/two-factor-authentication-best-practices
Command: npx skills add https://github.com/UmarSidiki/whatsapp-assistant --skill two-factor-authentication-best-practices-umarsidiki

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill provides comprehensive guidance and implementation rules for integrating secure two-factor authentication (2FA) into applications, ensuring user account security.

Core Features & Use Cases

  • Secure 2FA Setup: Guides developers on configuring the twoFactor plugin with app names and issuer details.
  • User Onboarding: Details how to enable 2FA for users, including password verification, QR code generation, and backup code management.
  • Authentication Flows: Explains how to handle TOTP, OTP (Email/SMS), and backup code verification during sign-in and other sensitive operations.
  • Trusted Devices: Covers the implementation and configuration of trusted devices to streamline user experience.
  • Security Best Practices: Addresses session management, rate limiting, encryption, and constant-time comparisons.

Quick Start

Configure the twoFactor plugin with your app name as the issuer for TOTP generation.

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 implement two-factor authentication using Better Auth?

To implement two-factor authentication with Better Auth, configure the twoFactor plugin with your app name as the issuer for TOTP generation, then handle user onboarding through password verification and QR code generation.

What is the best way to handle TOTP and backup codes in a 2FA flow?

The best way to handle TOTP and backup codes in a 2FA flow is to generate backup codes during user onboarding and allow their verification during sign-in alongside TOTP, ensuring secure access if a device is lost.

Does Better Auth support OTP verification via Email and SMS?

Yes, Better Auth supports OTP verification via Email and SMS. The Skill details how to handle these OTP methods during sign-in and other sensitive operations alongside TOTP and backup codes.

Can I configure trusted devices to streamline Better Auth 2FA sign-in?

Yes, you can configure trusted devices to streamline Better Auth 2FA sign-in. The Skill covers the implementation and configuration of trusted devices to improve user experience while maintaining security.

What security considerations are needed for 2FA session management?

Security considerations for 2FA session management include implementing rate limiting, encryption, and constant-time comparisons. These practices secure user account management and access control during sensitive operations.