Skip to main content

Browser Bridge

An agent needs to log into a site. The obvious way is to hand it the password and hope. The Browser Bridge is the other way: the agent drives the browser, asks which credential to use, and the bridge types it. The value never enters the agent's context, its logs, or its model provider's.

The client is open source — 1clawAI/browser-bridge, Apache-2.0, published as @1claw/browser-bridge.

Where this sits​

It is not an alternative to Playwright, Puppeteer, browser-use, Stagehand or Anthropic's Computer Use. Those answer how does the agent drive. This answers how does a credential get used without the agent holding it — which they leave to you.

Computer Usebrowser-useBrowser Bridge
Who types the passwordthe model, as an action it chosethe library, from a value your code supplieda separate process the agent cannot read from
Where the value livesin the action stream, so in the model's contextin the agent process (sensitive_data keeps it out of the prompt)only in the bridge, wrapped and zeroed after use
Under prompt injectioncan be told to read the field backcan be told to submit what it holds somewhere elsecan ask for a fill; cannot choose the page, read the field, or collect the value

browser-use is Playwright-based, so it connects to the bridge unchanged. Stock Puppeteer and Playwright clients do too.

How fast​

A full lifecycle against a live third-party site — create the account, sign in, capture the API key the site issues, and make a real request with it. No human at any step.

StageTimeWhat happens
Provision — register + store password2.13sThe bridge signs up, generates the password and stores it
Sign in — username + password + submit1.14sThe bridge logs in; the agent never sees the password
Capture — read + store the API key0.80sThe bridge reads the key in a window the agent never lands on
Use — request with the key injected0.37sThe key is injected; the agent passes only a city name
End to end4.43s

Most of that is opening a fresh page for each credential operation. That cost is also the control: the typing never happens on a page the agent has scripted, so a listener it installed earlier has nothing to observe.

The shape of it​

agent  ──CDP──▶  bridge  ──HTTPS──▶  vault
│
└──CDP──▶ Chromium

The bridge is the only process attached to Chromium. The agent talks to the bridge, not to the browser, and every command it sends crosses a gate.

Three separate credentials are involved, and the separation is the guarantee:

CredentialAnswersHeld by
bb_ device credentialwhich machinethe bridge, from pairing
user sessionwhich personthe human who paired it
agent JWTwhich agentthe agent

Collapsing any two lets one stand in for another. That is why authorising a fill needs the agent's token and the bridge's, while redeeming the grant needs the human's and the bridge's — and is refused outright for an agent principal. The agent asks which binding; it is refused when it tries to collect the answer.

Hosted setup (no API key)​

An app that wants a site set up does not need any 1Claw credential. It asks for the setup, and you approve it on 1claw.co:

curl -X POST https://api.1claw.co/v1/browser/setup-requests \
-H "Content-Type: application/json" \
-d '{
"client_name": "My agent app",
"device": { "label": "laptop", "public_key_pin": "<bridge public key>" },
"site": {
"label": "Acme",
"login_url": "https://app.acme.example/login",
"allowed_hosts": ["app.acme.example"],
"username": "me@acme.example",
"selectors": { "username": "#email", "password": "#password", "submit": "button[type=submit]" }
}
}'

Or from the CLI, which opens the page and polls for you:

1claw browser setup https://app.acme.example/login --public-key "<bridge public key>"

The response carries an approve_url, a user_code and a poll_secret. Show the code and open the link. On that page you check the code matches, type the site's password, and confirm once with your passkey. That single confirmation covers storing the password, creating the binding, pairing the device and giving an agent read access to that one password. The password goes from the page straight into your vault (browser-logins unless you pick another), so the app and the AI never see it.

Meanwhile the app polls:

curl -X POST https://api.1claw.co/v1/browser/setup-requests/<request_id>/poll \
-H "Content-Type: application/json" \
-d '{"poll_secret":"bsp_..."}'

It gets pending until you decide. The first poll after approval returns the binding, a bb_ device credential and, unless the request named an existing agent_id, a new agent's ocv_ key that can read only that password. Both are created at that moment and returned once; a later poll says delivered. With those two, the app needs no human key: opening a session and collecting a fill accept the bb_ credential on its own.

To add another site from a bridge that is already paired, send the same request with the x-1claw-bridge-credential header and the existing agent_id; the device is reused rather than paired again.

Approve only a request you started. Anyone can create one and send you the link, which is why the page shows the code, the device name and the address the request came from. Requests expire after 15 minutes.

The page asks for the password twice (with a show-password toggle) and won't approve until both match, so a typo is caught before it is stored. When the request names an existing agent that is limited to certain vaults, the page offers only those vaults, and the vault refuses an approval that would put the password somewhere the agent can't read (another vault, a vault created now, or a path its fixed scopes don't cover). Before, that approval went through and the first sign-in failed.

Approval by a platform's customers​

A platform built on the Platform API can ask its own customers to approve a site, with a passkey and no 1Claw login. See Browser Bridge sign-in, approved by your customer.

Several sites at once​

An app adding more than one site creates a request for each, then sends you one link instead of several:

https://1claw.co/browser-setup/batch?ids=<request_id>,<request_id>

The page lists exactly those requests (up to 20), each with its code, username, password (typed twice) and optional authenticator key. You pick one vault for all of them, confirm the codes match, and approve with one passkey. The API is POST /v1/browser/setup-requests/approve-batch: every item is checked first, and one that would be refused stops the batch before the confirmation is spent; then each is written and reported. Each request's app collects its result by polling as usual.

Sites that ask for an authenticator code​

On the approval page, tick This site asks for an authenticator code and paste the site's setup key (the base32 key shown under "can't scan the code?", or an otpauth:// link). It is stored next to the password at <secret_path>-totp, and the agent is given read access to both.

At fill time the vault computes the current 6-digit code and sends only the digits, with the password (x-1claw-totp); the key never leaves the vault. After submitting the password, the bridge (0.3.1 and later) follows the sign-in to the code page, but only on the binding's own hosts, types the code and submits. The fill result says what happened at that step, never the code:

secondFactorMeaning
typedThe code was typed on a page on the binding's hosts.
not_askedNo code field appeared; the site let you in without one.
off_binding_hostThe next page was on a host the binding doesn't name, so nothing was typed.
unavailableThe vault could not make a code (the key is missing or unreadable).

Every fill result also says whether a one-time-code field is still showing on the page it ended on (codeFieldShown).

Sites that email or text a code​

With no authenticator key saved, a site that asks for a code it sent by email or SMS used to end the fill there. From bridge 0.4.0 the fill pauses instead:

{ "status": "code_wanted", "handle": "…", "expiresAt": "…", "attemptsLeft": 3,
"leftLoginPage": true, "passwordFieldShown": false }

The agent fetches the code from its inbox and answers with the submit_code tool (bridge.submitCode(handle, code)). The bridge types it on the paused page, which is the page the password was typed on and is never opened to the agent, submits, and returns the usual filled result. A wrong code returns code_wanted again with a new handle; after three codes, or when the handle expires (5 minutes by default, codeWaitMs), the paused page is closed. The pause happens only on the binding's own hosts; elsewhere the fill returns filled with codeFieldShown: true as before.

This puts both sign-in factors in one place, which is why it is opt-in per site. Use it for sites an agent has to sign in to on its own; the alternative is usually an automation script holding both itself. A binding created by hand takes totp_secret_path (a secret in the same vault) and an optional selectors.totp for the code field.

Sites set up once work on every paired machine​

The username and form selectors stored with a binding come back with each fill grant (and, for older bridges, as headers on the collected fill). Bridge 0.3.0 and later type the username first and use the binding's selectors, preferring them to a selector the agent passes. An app does not need to keep its own per-site profile.

Username-first sign-in pages (Google, Microsoft, many banks), where the password field only appears after "Next", work too: when no password field shows after the username, the bridge submits the username and waits for the password, on a new page or the same one. If that step lands on a host the binding doesn't name, it types nothing and reports an error.

An agent can list every site it can sign in to, wherever it was set up, with its own token:

curl https://api.1claw.co/v1/browser/credentials -H "Authorization: Bearer <agent token>"

That returns names, login URLs, usernames and selectors, never a password. Use an agent token minted after the site was added: an agent's token covers the paths its policies allowed when the token was minted, so an older token does not see a site approved since. To forget a site, the agent deletes the binding together with its paired bridge credential:

curl -X DELETE https://api.1claw.co/v1/browser/credentials/<binding_id> \
-H "Authorization: Bearer <agent token>" \
-H "x-1claw-bridge-credential: bb_..."

Only bindings whose password the agent can read can be removed this way, and only the binding goes: the stored password stays in your vault, and deleting it is done in the dashboard.

Getting started​

npm install -g @1claw/browser-bridge

Or work from source — the repo is Apache-2.0 and the demo runs with no account:

git clone https://github.com/1clawAI/browser-bridge
cd browser-bridge && pnpm install && pnpm build
node packages/browser-bridge/examples/demo.mjs

To do the same by hand, pair the machine (a human action, behind step-up re-auth):

1claw browser pair laptop --public-key "<bridge public key>"

Or against the API directly:

curl -X POST https://api.1claw.co/v1/browser/devices \
-H "Authorization: Bearer $USER_TOKEN" \
-H "X-Auth-Confirm: $REAUTH_TOKEN" \
-H "Content-Type: application/json" \
-d '{"label":"laptop","public_key_pin":"<bridge public key>"}'

X-Auth-Confirm takes a re-auth token for purpose browser.device.pair from POST /v1/auth/reauth/complete; your password is accepted there only when no passkey or authenticator app is enrolled. The bb_ credential comes back once and is never returned again.

Define a binding — which secret may be typed, and where:

curl -X POST https://api.1claw.co/v1/browser/credentials \
-H "Authorization: Bearer $USER_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"label": "acme-login",
"vault_id": "<vault>",
"secret_path": "acme/password",
"login_url": "https://app.acme.example/login",
"allowed_hosts": ["app.acme.example"],
"username": "me@acme.example",
"selectors": { "username": "#email", "password": "#password" }
}'

A bare host matches only itself. A leading dot (.acme.example) matches that host and any subdomain. A * is refused at creation rather than stored, because a stored *.example.com would match nothing while looking permissive.

username and selectors are optional and not secret. They are returned when bindings are listed, and with each fill in the x-1claw-username and x-1claw-selectors headers (base64), so a site works on a second machine without a local profile file.

Then point your framework at the bridge:

await puppeteer.connect({ browserWSEndpoint: bridge.url });
await chromium.connectOverCDP(bridge.url);

Stock Puppeteer and Playwright clients work, and so do the agent frameworks built on them. Playwright (0.4.0 and later): clicks, fill on ordinary inputs, waitForSelector, newCDPSession, and context.cookies(), addCookies() and clearCookies(), which are confined to the caller's own browser context. Request interception (page.route) and response bodies stay refused, for every client.

Behind an authenticating proxy​

Chromium's proxy password prompt is answered with a command that could also read requests in flight, so the gate refuses it. Give the bridge the proxy instead:

const bridge = await startBridge({
// …
proxy: { server: "http://proxy.example:8080", username: "u", password: async () => getProxyPassword() },
});

The bridge runs a small relay on 127.0.0.1 that adds the proxy's credentials and points Chromium at it. The agent never sees the prompt or the password.

What the gate refuses​

  • Runtime.evaluate during a fill. The whole target is blocked while a credential is being typed, not just the field — and the fill happens on a page the agent has never had a session on, so a listener installed earlier has nothing to observe.
  • Another agent's pages. Each client gets its own Chromium browser context. Target.getTargets is narrowed to the caller's own pages, and attaching to someone else's is refused even with the id in hand.
  • Response bodies. Network.getResponseBody and the events carrying raw headers are not forwarded — filtering a response after the fact does not help when the side effect is the exfiltration.

Authorising a fill​

The bridge asks the vault whether this fill is allowed, on this page, right now. The request carries what the vault needs to decide:

{
"session_id": "...",
"binding_id": "...",
"tab_origin": "https://app.acme.example",
"frame_origin": "https://app.acme.example",
"form_action_origin": "https://app.acme.example",
"frame_id": "...",
"generation": 7,
"form_path": "/login",
"field_names": ["username", "password"],
"redirect_chain": ["sso.acme.example"],
"current_generation": 7
}
All four of the last fields are required

form_path, field_names, redirect_chain and current_generation are not optional. A request missing any of them is refused with a 400 naming them.

Send current_generation as the generation you observe now, and generation as the one the request was decided against. Sending the same value for both makes the staleness check compare a value to itself — which is exactly the bug that made it useless before these fields were required.

The vault answers with a grant, a denial and a reason, or a pending approval. A grant includes the binding's login_url, and its username and selectors when it has them. A grant is single-use, lives 60 seconds, is refused if the page navigated in the meantime, and is capped at five fills per binding per ten minutes.

Losing a laptop​

List what is paired, and revoke it:

1claw browser devices          # revoked ones are listed too
1claw browser revoke <device-id>

Revoked devices stay in the list rather than disappearing, because "was this machine ever paired" is the question people ask after a laptop goes missing. Revocation takes effect immediately — a revoked bb_ opens no sessions and authorises no fills.