two-factor-authentication-best-practices

Configure Better Auth's twoFactor plugin for enrollment, verification, and backup codes.

Updated Jan 4, 2024
One-click install
npx skills add https://github.com/zeis974/TaxDOM --skill two-factor-authentication-best-practices-zeis974
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: two-factor-authentication-best-practices
Source: https://github.com/zeis974/TaxDOM/tree/main/apps/dashboard/.agents/skills/two-factor-authentication-best-practices
Command: npx skills add https://github.com/zeis974/TaxDOM --skill two-factor-authentication-best-practices-zeis974

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This guide helps organizations implement robust two-factor authentication using Better Auth's twoFactor plugin, reducing the risk of account compromise and simplifying secure login workflows.

Core Features & Use Cases

  • Guidance for enabling 2FA for users, configuring TOTP authenticator setup, delivering OTP via email or SMS, and managing backup codes.
  • Clear sign-in and recovery flows, including device trust and fallback options for users.
  • Real-world scenarios: securing consumer or enterprise apps with MFA without disrupting user experience.

Quick Start

Integrate the twoFactor plugin into your server and client configuration, then test a full sign-in flow to verify the 2FA setup.

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 in a web application?

To implement two-factor authentication in a web application, integrate the Better Auth twoFactor plugin into your server and client configuration to enable TOTP enrollment, OTP delivery, and backup codes.

What configuration options are required for TOTP and OTP setup?

Required configuration options for TOTP and OTP setup include specifying the issuer, totpOptions, otpOptions, backupCodeOptions, twoFactorCookieMaxAge, and trustDeviceMaxAge within the twoFactor plugin.

How does 2FA device trust and sign-in recovery work?

2FA device trust and sign-in recovery work by configuring trustDeviceMaxAge and twoFactorCookieMaxAge to manage trusted devices, while using backup codes as a fallback option for user recovery.

What safeguards are needed for two-factor authentication server configuration?

Safeguards needed for two-factor authentication server configuration include implementing secure storage mechanisms for backup codes and applying rate-limit safeguards to protect the verification endpoints.

Can I deliver two-factor authentication OTP via email or SMS?

Yes, you can deliver two-factor authentication OTP via email or SMS by configuring the otpOptions within the Better Auth twoFactor plugin to define your preferred delivery channels.