Manual MFA with Browserbase Contexts
Persist MFA authentication across sessions using Browserbase Contexts
TypeScript
Source codenpx create-browser-app --template manual-mfa-with-contexts
Python
Source codeuvx create-browser-app --template manual-mfa-with-contexts
Get started with MFA persistence using Browserbase Contexts
This template demonstrates how to persist authentication across sessions using Browserbase Contexts, eliminating MFA friction after the first login. The first session creates a context and completes MFA manually, saving the authentication state including MFA trust/remember device state. Subsequent sessions reuse the context with no MFA required. Perfect for payment automation, account management workflows, and compliance automation where you need to complete MFA once and then automate future sessions without MFA prompts.
Steps
- Create a new Browserbase context to persist authentication state
- First session: Navigate to login page and fill in credentials
- Detect MFA prompt and pause for manual MFA completion
- Wait for user to complete MFA in the browser session
- Context automatically saves authentication state including MFA trust
- Second session: Reuse context with no login or MFA required
- Verify authentication by checking logged-in state