Demonstrates how to automate two-factor authentication testing using Playwright and Mailosaur. Covers three authentication methods: email magic links, SMS verification codes, and TOTP authenticator apps. Shows how to programmatically access virtual email addresses and phone numbers, extract verification codes, and handle time-sensitive TOTP tokens. Includes practical code examples for each authentication flow, timeout handling, and inbox cleanup strategies.
Table of contents
Getting startedMethod 1: Email magic linksMethod 2: SMS verification codesMethod 3: Authenticator apps (TOTP)Common gotchas and tipsSort: