two-factor-authentication-best-practices

Implement TOTP, OTP, backup codes, and trusted devices with Better Auth.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides comprehensive guidance and practical code examples for implementing secure two-factor authentication (2FA) within an application, ensuring user accounts are protected against unauthorized access.

Core Features & Use Cases

  • TOTP (Authenticator App) Setup: Guides users through setting up time-based one-time passwords with authenticator apps like Google Authenticator or Authy.
  • OTP (Email/SMS) Integration: Details how to send and verify one-time passcodes via email or SMS, requiring custom delivery implementation.
  • Backup Code Management: Explains the generation, display, and secure use of backup codes for account recovery.
  • Trusted Devices: Covers the functionality to allow users to trust devices for a period, reducing friction for frequent users.
  • Use Case: A developer needs to add a secure login flow to their web application. This skill provides the exact code snippets and configuration options to integrate TOTP and backup codes, making the authentication process significantly more secure.

Quick Start

Configure the twoFactor plugin with your app name as the issuer and add the client plugin for two-factor verification.

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 TOTP with an authenticator app?

Two-factor authentication using TOTP requires configuring a twoFactor plugin with your app name as the issuer and setting up a client plugin to verify time-based one-time passwords during user login flows.

What is the best way to handle 2FA backup codes for account recovery?

2FA backup codes should be generated and displayed securely during the setup process, allowing users to store them for account recovery when they lose access to their primary authenticator app or one-time passcode delivery method.

Can I send one-time passcodes via SMS or email for two-factor authentication?

Yes, you can send one-time passcodes via SMS or email for two-factor authentication, but this requires custom delivery implementation to integrate external services that handle OTP delivery to users.

Does this 2FA implementation support trusted devices to reduce login friction?

Yes, this 2FA implementation supports trusted devices, allowing users to bypass frequent two-factor verification on specific devices for a set period, which reduces login friction for regular users.

Do I need an existing user authentication flow to add two-factor authentication?

Yes, you need an existing user authentication flow to add two-factor authentication, because the 2FA implementation must integrate with your current login processes to securely verify users before granting access.