Prompt

How do I automate browser interactions for a portal that requires login and MFA?

Technology / Testing & QA1 observationLast seen Oct 26, 2026

Latest observation

Oct 26, 2026OpenAI APIWeb search: off

Automating a portal that requires login + MFA is usually best done with a supported automation approach rather than trying to bypass the MFA flow.

Good options

1) Use the portal’s API or SSO integration if available

Best case:

  • The portal has an API, service account, or OAuth/OIDC integration.
  • You can use a machine-to-machine token, client credentials, or delegated auth.
  • This avoids brittle browser automation entirely.

2) Use browser automation with a human-in-the-loop MFA step

If you must use the browser:

  • Use tools like Playwright or Selenium.
  • Automate everything up to the MFA prompt.
  • Pause and let a user complete MFA interactively.
  • Reuse the authenticated session afterward if the portal allows persistent sessions.

Typical pattern:

  • Open browser
  • Enter username/password
  • Stop at MFA challenge
  • Human completes MFA
  • Save session state/cookies/local storage
  • Reuse saved session in later runs until it expires

3) Use a dedicated automation account with approved MFA handling

If your organization permits it:

  • Create a service or automation account.
  • Use MFA methods approved by your security team, such as:
    • FIDO2/security key attached to a runner
    • TOTP stored in a secure secrets vault
    • Device-based approval with controlled access
  • Rotate credentials and monitor usage

Important security note

I can’t help with bypassing or defeating MFA. The safe approach is to:

  • use approved auth flows,
  • preserve security controls,
  • and work with IT/security to set up a compliant automation path.

Practical Playwright approach

A common pattern is:

  1. Launch browser in headed mode for first-time login
  2. Log in manually or through automation
  3. Complete MFA manually
  4. Save session state
  5. Reuse the session on future runs

Conceptually:

# Pseudocode
launch browser
open login page
fill username/password
pause for MFA
wait for user to finish login
save storage state / cookies
close browser

Then later:

# Pseudocode
launch browser with saved state
go directly to portal
perform automated tasks

Handling session expiry

Expect:

  • tokens to expire,
  • re-authentication to be required,
  • MFA to be challenged occasionally.

Plan for:

  • detecting login redirects,
  • falling back to interactive login,
  • retrying with a fresh session.

Recommended tools

  • Playwright: modern, reliable, great session storage support
  • Selenium: widely used, works well if the portal is legacy-heavy
  • RPA tools: UiPath, Power Automate, etc., if your organization prefers low-code

Best practice checklist

  • Get explicit approval from the portal owner/security team
  • Prefer API over browser automation
  • Use a dedicated automation account
  • Store secrets in a vault
  • Save and reuse session state only as allowed
  • Add audit logging and alerting
  • Handle session expiry gracefully

If you want, I can show you a safe Playwright example that pauses for MFA and then reuses the session on subsequent runs.

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (1 observation for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as dotdotPR. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.