> ## Documentation Index
> Fetch the complete documentation index at: https://docs.browser-use.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 2FA

> Handle two-factor authentication in API V4 runs.

The most reliable options are a saved profile or a human checkpoint.

## Reuse a logged-in profile

[Sync your local login](/cloud/guides/profile-sync), then load that profile in
the run:

<CodeGroup>
  ```python Python theme={null}
  run = client.runs.create(
      "Download my latest invoice",
      browser_settings={"profileId": "YOUR_PROFILE_ID"},
  )
  ```

  ```typescript TypeScript theme={null}
  const run = await client.runs.create({
    task: "Download my latest invoice",
    model: "grok-4.5",
    browserSettings: {
      profileId: "YOUR_PROFILE_ID",
      proxyCountryCode: "us",
    },
  });
  ```
</CodeGroup>

This avoids another 2FA challenge while the site's cookies remain valid.

## Let a human take over

Ask the first run to stop at the 2FA screen, get its `live_view_url` from the
[`browser.ready` event](/cloud/agent/human-in-the-loop), and have the user enter
the code. Then continue with the same session:

<CodeGroup>
  ```python Python theme={null}
  first = client.runs.create(
      "Open the login page and stop at the 2FA prompt",
  )
  client.runs.wait_for_completion(first.id)

  next_run = client.runs.create(
      "Continue after login and download the invoice",
      session_id=first.session_id,
  )
  ```

  ```typescript TypeScript theme={null}
  const first = await client.runs.create({
    task: "Open the login page and stop at the 2FA prompt",
    model: "grok-4.5",
  });
  await client.runs.waitForCompletion(first.id);

  const nextRun = await client.runs.create({
    task: "Continue after login and download the invoice",
    model: "grok-4.5",
    sessionId: first.sessionId,
  });
  ```
</CodeGroup>

See [Human in the loop](/cloud/agent/human-in-the-loop) for retrieving and
embedding the live browser URL. Never put passwords or TOTP secrets directly
in a prompt.
