# Reuse a browser login

Import cookies, history and bookmarks on the computer to give an approved agent a separate browser with
your existing logins. This is a one-time copy. Later sign-ins and sign-outs stay
separate, and some sites will ask you to sign in again. Passwords, open tabs,
extensions, local storage, and Firefox container identities are not copied.

## On the computer

Use Node 22.13 or newer. Keep Chrome, Chromium, Helium, Edge, or Brave installed to
run the separate agent browser. To choose another compatible Chromium executable,
set `EZREMOTE_BROWSER_EXECUTABLE` to its absolute path before importing.
Use a full browser build; the reduced `chrome-headless-shell` does not restore
session-only cookies and is rejected.

1. Run `ezremote browser list` to see source browsers and their profile IDs.
2. Quit the source browser. Run `ezremote browser import firefox 1`, replacing
   `firefox` and `1` with your browser and profile ID. A single profile needs no ID.
3. Read the prompt and approve locally. Any agent with browser permission on this
   computer can use the copied accounts. Declining leaves them untouched.
4. Save the returned profile UUID. `ezremote browser profiles` lists imported profiles.

Copied browsing data stays in the helper's private `~/.ezremote/browser-profiles/` directory.
The import reports imported and skipped cookie counts, never cookie values.
Creating an imported profile does not grant an agent browser permission.

Close the agent browser before removing a copy with
`ezremote browser remove PROFILE_UUID`. Removal deletes only the copied profile.
Signing out in the source browser does not reliably revoke its copy; remove the
copy or revoke the website's sessions too.

## Browser support

The source can be Chrome, Chromium, Edge, Brave, Vivaldi, Opera, Arc, Dia, Helium,
Firefox, Zen, LibreWolf, or Safari. Discovery follows their standard installed
profile locations, including Firefox Snap and Flatpak profiles on Linux. Profiles
and installation paths vary; the list shows only profiles with a cookie store.

- macOS: Chromium-family imports may ask to unlock the browser's Keychain item.
  The command-line reader uses Apple's `security` tool. Choose **Allow** for this
  import rather than **Always Allow**. Safari needs Full Disk Access for the
  terminal running the helper; grant it in System Settings, retry, then revoke it
  afterward if desired. Safari additional profiles appear by their store UUID.
- Linux: Firefox-family imports read their cookie database. Chromium `v11`
  cookies need `secret-tool` and an unlocked Secret Service keyring. If that key
  is unavailable, those cookies are skipped; legacy `v10` cookies can still import.
- Windows: Firefox-family imports work without a browser encryption key. Standard
  DPAPI Chromium profiles are supported, including Helium where applicable.
  App-bound encrypted profiles are rejected. Ordinary Chrome/Edge installations
  may have this protection; sign in manually in the separate browser instead.

Partitioned cookies and Firefox container/private cookies are skipped rather than
merged into another identity. Safari cookies use conservative SameSite=Lax.
Imports do not automate Firefox or Safari themselves; the copied sessions run
in the separate Chromium browser. Site-specific login and encryption differences
mean successful cookie import does not guarantee every account remains signed in.

## From an agent

Call `browser_call` with `name: "profiles/list"` and the selected `deviceId`.
Choose an approved profile UUID, then include `profile` on subsequent calls:

```json
{
  "deviceId": "COMPUTER_UUID",
  "profile": "IMPORTED_PROFILE_UUID",
  "name": "tools/list"
}
```

Discover tool names and inputs before using them. Pass the same `profile` with
each tool call. Omit `browser` when using `profile`. A call without `profile`
uses the helper-owned browser and its separate local approval.

Pi accepts `profile` on `ezremote_browser`. With the SDK:

```ts
await computer.browser("profiles/list");
await computer.browser("tools/list", {}, undefined, { profile: profileId });
```

Session import requires the person's local confirmation. Agents should give them
the command to run rather than attempting an unattended import. Existing
token expiry, revocation, and browser operation permissions still apply.

## Managed browser

Browser calls launch a separate Chromium profile under the helper state directory,
visible by default. Set `EZREMOTE_BROWSER_HEADLESS=1` on the computer for headless
use. The agent can act in every tab of this browser with its imported sign-ins.
The connection's Browser permission row supplies local approval.

The helper removes Chromium's automation banner flag, disables the
`AutomationControlled` Blink feature so `navigator.webdriver` is false, and uses a
1365 by 900 window. Headless mode reads this installed binary's user agent through
CDP and removes only the `HeadlessChrome` product marker. Locale and timezone
inherit the computer's settings. No stealth plugins or other device identities
are used. These changes do not guarantee that websites accept automation.

Executable lookup checks `EZREMOTE_BROWSER_EXECUTABLE`, then installed browsers,
then downloads full Chrome for Testing into the helper state directory. Downloads
use HTTPS and Google's storage MD5 integrity header, extract only after validation,
and publish the completed directory by rename. Failed attempts delete staging
files and can be retried from the beginning. The downloaded version stays fixed
until that local installation is removed.

History imports copy up to 50,000 URL records, with titles and last-visit times.
Bookmark imports copy up to 50,000 URLs into the bookmarks bar; source folder
structure is flattened. Firefox-family stores map to Chromium records. Safari copies history and bookmarks from its default store, even when a separate
cookie-store UUID is selected. Local storage is omitted because copying its
engine-specific stores can mix origins or break application state. Saved passwords
are never read. All copying happens locally; the Worker receives no imported data.

Live attach to the person's daily Chrome or Helium has been removed. Use the
separate managed browser and import instead. Legacy `browser` values `chrome` and
`helium` both select the same default profile and do not choose a browser.
The connection's Browser permission row supplies local approval; background
browser calls never ask for terminal input. Import commands still confirm locally.

On first use, `browser_installing` means Chromium is downloading in the background
and no browser action ran. Wait a few seconds and retry that call. This specific
error is safe to retry; never automatically retry `outcome_unknown`. Linux needs
`unzip` or `bsdtar` for automatic extraction, or an installed Chrome/Chromium.
Headless user agents are cached locally by executable path and modification time.
History import creates matching URL and visit records in one transaction; if the
database is absent or empty, Chromium initializes its own schema first.
