two-factor-authentication-best-practices

Configure Better Auth's twoFactor plugin for secure two-factor authentication.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill provides practical guidance and enforcement rules for implementing secure two-factor authentication (2FA) using Better Auth's twoFactor plugin across web applications.

Core Features & Use Cases

  • Guidance on configuring TOTP-based authenticator apps, OTP delivery, backup codes, and trusted devices.
  • Step-by-step integration patterns for client and server sides, including enabling 2FA, verifying codes, and handling sign-in flows.
  • Security best practices around session management, credential protection, and code storage.

Quick Start

Configure Better Auth 2FA in a new app using the twoFactor plugin and outline the default settings and deployment steps.

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's twoFactor plugin?

You implement two-factor authentication using Better Auth's twoFactor plugin by configuring TOTP, OTP delivery, and backup codes. The Skill provides step-by-step integration patterns for enabling 2FA, verifying codes, and handling sign-in flows across client and server boundaries.

What are the best practices for backup codes and trusted devices in 2FA?

Best practices for backup codes and trusted devices involve configuring backupCodeOptions and cookie trust settings. The Skill provides guidance on secure code storage, session management, and enabling trusted devices to streamline user verification without compromising credential protection.

Can I configure TOTP and OTP options separately in Better Auth?

Yes, you can configure TOTP and OTP options separately in Better Auth using totpOptions and otpOptions. The Skill outlines default settings and configurable parameters for authenticator apps and OTP delivery mechanisms.

How does Better Auth handle 2FA session management across client and server?

Better Auth handles 2FA session management by enforcing secure verification flows and cookie trust settings across client and server boundaries. The Skill details integration patterns for maintaining session integrity and protecting credentials during sign-in.

When should I use TOTP versus OTP delivery for two-factor authentication?

Use TOTP for authenticator app-based verification and OTP for code delivery methods like email or SMS. The Skill clarifies both approaches, offering configurable totpOptions and otpOptions to suit different application security requirements.