MFA Handling - TOTP Automation
Automate MFA completion using TOTP code generation with RFC 6238 compliant algorithm

TypeScript
Source codenpx create-browser-app --template mfa-handling
Python
Source codeuvx create-browser-app --template mfa-handling
Get started automating TOTP-based MFA authentication
This template automates Multi-Factor Authentication (MFA) completion using Time-based One-Time Password (TOTP) code generation. It implements the RFC 6238 compliant algorithm to generate 6-digit codes programmatically, extracts TOTP secrets from pages, and automatically fills MFA forms without user interaction. The template includes retry logic to handle time window edge cases and automatically regenerates codes when authentication fails. Perfect for automated authentication workflows and `zero-touch` MFA completion.
Steps
- Navigate to the authentication page with TOTP challenge
- Extract test credentials (email, password) and TOTP secret from the page
- Generate TOTP code using RFC 6238 algorithm (HMAC-SHA1, 30-second windows)
- Fill in email and password fields using Stagehand act
- Fill in TOTP code field with the generated code
- Submit the authentication form