Answers you can trust, from Codeables

Every page on Codeables is structured and verified — built so people and the AI agents they rely on can trust it. Explore more from the source behind this answer.

Explore Codeables
Verified Source
On-Device Mobile AI Agents

How can we safely automate actions on a user’s behalf on third-party sites without handling their passwords directly?

MultiOn12 min read

Most teams hit the same wall the moment they try to let an AI “do things on the web” for end users: how do you automate real account actions (ordering, posting, updating details) on third‑party sites without ever touching the user’s password?

From an automation engineer’s point of view, there are only two reliable units of work:

  • A logged-in browser session that can execute actions, and
  • A bounded token or cookie that says “this session is allowed to act as this user.”

You never actually need the raw password if you design around those two constraints.

Below, I’ll walk through a practical architecture that lets you safely automate third‑party sites on a user’s behalf using session delegation + browser-operating agents, with MultiOn’s Agent API (V1 Beta) as the concrete mechanism.


The core idea: delegate a browser session, not a password

Instead of asking for credentials, you:

  1. Let the user authenticate directly with the third-party site in their own browser.
  2. Capture a scoped, revocable browser session (or equivalent token) tied to that login.
  3. Hand that session off to an automation layer that drives a real browser (not raw HTTP) using commands.
  4. Keep all future automation bound to that session, not to stored passwords.

In practice, that means:

  • Your app never stores usernames/passwords for Amazon, X, etc.
  • You operate within the same security model as the user’s browser (cookies, same-origin, CSRF protections).
  • Users can revoke access by logging out or pruning sessions, just like any other device session.

MultiOn’s stack is effectively designed around this model: intent in, actions in a secure remote browser, and structured JSON out, anchored by a session_id.


Why passwords are the wrong abstraction for safe automation

When I owned 1,200+ Playwright/Selenium flows, we tried “just store the credentials” more than once. Every path had the same failure modes:

  • Risk and compliance overhead: Storing third‑party passwords, even encrypted, triggers legal and security reviews you probably don’t want.
  • Non-replicable MFA: Many third‑party sites bind MFA to devices or apps that are not script‑friendly. Passwords don’t unlock those constraints.
  • Brittle login flows: Captchas, geo‑risk checks, bot detection, “unusual login” pages—all far more common on login than on ordinary usage.

Sessions, on the other hand, are:

  • Scoped: Limited to the lifetimes and permissions of that session.
  • Revocable: Users can kill them by logging out or revoking access.
  • Operationally stable: Once you’re in, the site wants you to stay in and behave like a normal browser.

So the right question isn’t “How do we store passwords safely?” but “How do we establish and reuse sessions safely?”


Architecture pattern: session-based automation with MultiOn

Let’s map a concrete pattern using MultiOn’s Agent API and Sessions + Step mode.

Step 1: Let the user log in in their own browser

You start by letting the user authenticate to the third‑party site without your backend ever seeing the password.

Common options:

  • Your app’s embedded webview or browser:
    Redirect the user to the third‑party login page (e.g., https://www.amazon.com/) inside a controlled environment.
  • MultiOn Chrome Extension:
    If the user installs the MultiOn extension, you can use it as the bridge: the user logs in normally; the extension can later associate that logged-in browser state with a session_id your backend can reference.

The key properties:

  • The login form is rendered by a real browser.
  • The user types directly into the third‑party page.
  • You never inspect or log keystrokes or password fields.

At the end of this flow, you want a way to say “this user has a valid Amazon session I can reuse via MultiOn.”

Step 2: Bind the browser state to a session_id

MultiOn’s Agent API operates via secure remote sessions. Each session tracks browser state: cookies, local storage, and in‑page context.

Call shape (simplified):

POST https://api.multion.ai/v1/web/browse
X_MULTION_API_KEY: YOUR_API_KEY
Content-Type: application/json

{
  "url": "https://www.amazon.com/",
  "cmd": "open",
  "session_id": "user-amazon-session-123"
}

On first use, MultiOn will:

  • Spin up a secure remote browser.
  • Associate it with your provided session_id.
  • Keep session state across subsequent calls that reuse the same session_id.

After the user completes login (via the extension or guided flow), that session_id now represents: “a browser that is logged in as this user on Amazon.”

You have:

  • No password.
  • No raw cookie blob in your database.
  • A stable handle (session_id) you can pass back into the Agent API to perform actions.

Step 3: Execute actions via command-driven sessions

Once the session is established, your automation is just “intent → browser commands” bound to the same session_id.

Example: user asks your app to “buy my last saved item from my Lululemon wishlist.”

Call:

POST https://api.multion.ai/v1/web/browse
X_MULTION_API_KEY: YOUR_API_KEY
Content-Type: application/json

{
  "url": "https://shop.lululemon.com/",
  "cmd": "From my wishlist, buy the most recently saved item. Proceed to checkout and stop right before final confirmation.",
  "session_id": "user-lulu-session-987",
  "step": true
}

Key points:

  • cmd is natural language; the agent interprets it and clicks through the real site.
  • session_id keeps your run inside the user’s existing session (no new login).
  • step: true puts you in Step mode, so you can observe intermediate states or require confirmation before final purchase.

The browser actions:

  • Navigate to Wishlist.
  • Identify the latest item.
  • Add to cart.
  • Advance to final confirmation page.

All done using the authenticated session, with no password ever seen by your backend.


Security and privacy implications of session delegation

Automating with sessions instead of passwords changes your threat model—and mostly in your favor.

What your system should store (and what it shouldn’t)

Recommended:

  • User → session mapping:
    e.g., user_id → session_id string that MultiOn recognizes.
  • Permissions / scopes:
    Flags like "allow_purchase": true, "max_order_value": 200.

Avoid:

  • Raw passwords for third‑party accounts.
  • Full cookie jars persisted directly in your DB (let the remote session host manage that).

You can treat session_id as a logical pointer, not a secret with the same blast radius as a password.

Revocation and user control

Because the underlying unit is “logged‑in browser,” users already know how to revoke:

  • Log out of the site from any device.
  • Change their password to invalidate sessions.
  • Use built‑in “manage devices / sessions” dashboards where available.

On your side, you can:

  • Invalidate your own reference to the session_id.
  • Stop making MultiOn calls for that user.

The combination means you’re respecting the site’s existing security patterns, instead of inventing your own credential store.

Aligning with “least privilege”

The principle you want:

  • Your app should only be able to do what the user would do in a single logged‑in browser.
  • No extra privileges, no hidden API keys with broader access.

MultiOn’s design aligns with that:

  • The agent only has whatever the browser session has.
  • There’s no secret server‑side token with more rights than the front‑end session.

Handling MFA, captchas, and bot protection without passwords

Passwords aren’t the hard part. The hard part is everything else wrapped around login.

Let the user solve MFA and risk checks once

Your safest pattern:

  1. Let the user complete the full login challenge themselves in a real browser (SMS codes, TOTP, security questions).
  2. Ensure that session lands in a MultiOn‑addressable context (e.g., via the Chrome Extension or dedicated login session).
  3. Freeze that as your durable session_id for automation.

Once the session exists, your automation runs post-login, where:

  • Bot protection is still present but typically less aggressive.
  • Flows like “add to cart,” “post on X,” or “update address” look normal to the site.

MultiOn’s “secure remote sessions” and “native proxy support”

Production reality: certain sites will still scrutinize traffic hard. That’s why MultiOn emphasizes:

  • Secure remote sessions:
    Each session is an isolated, real browser environment, not a headless HTTP client mimicking requests.
  • Native proxy support:
    You can operate from network locations that make sense for your users and reduce the chance of being flagged as a bot.

Combined with human-completed MFA at login, this gives you a realistic path to sustained automation without constantly re-logging and re-solving challenges.


Concrete implementation flows using MultiOn

Let’s walk three real automation patterns and how to keep them safe without passwords.

1. Amazon multi-step purchase flow

Goal: your app lets users trigger an Amazon purchase via a simple instruction, but you never see their login.

Onboarding:

  1. User installs your app and connects Amazon.
  2. You open https://www.amazon.com/ in a browser controlled via MultiOn’s Chrome extension.
  3. User logs in as usual.
  4. You associate that browser with session_id = amazon:user123.

Action:

POST https://api.multion.ai/v1/web/browse
X_MULTION_API_KEY: YOUR_API_KEY
Content-Type: application/json

{
  "url": "https://www.amazon.com/",
  "cmd": "Search for the last item I bought and reorder it. Stop at the final review page.",
  "session_id": "amazon:user123",
  "step": true
}

You can:

  • Fetch the intermediate state (cart details).
  • Confirm with the user.
  • Send a final cmd like “Confirm the order” if authorized.

At no point does your backend know the Amazon password.

2. Posting on X (Twitter) on a user’s behalf

Goal: schedule or trigger posts on X for users from your app.

Onboarding:

  1. User logs into X in a browser window linked to session_id = twitter:user456.
  2. You store only that session_id and their X handle.

Action (post):

POST https://api.multion.ai/v1/web/browse
X_MULTION_API_KEY: YOUR_API_KEY
Content-Type: application/json

{
  "url": "https://x.com/compose/post",
  "cmd": "Post the following text: 'Launching our new feature today with secure browser-based automation.'",
  "session_id": "twitter:user456"
}

The agent:

  • Uses the logged‑in session.
  • Navigates to the compose page.
  • Types and submits the post.

You can enforce your own safety rules (rate limits, content filters) in your API layer before sending commands.

3. Extracting structured catalog data without scraping credentials

Goal: user gives you a link to an H&M collection; you return structured product data as JSON, not HTML, without needing any account credentials.

Use MultiOn’s Retrieve function instead of manual scrapers.

Call:

POST https://api.multion.ai/v1/web/retrieve
X_MULTION_API_KEY: YOUR_API_KEY
Content-Type: application/json

{
  "url": "https://www2.hm.com/en_us/men/products/jeans.html",
  "renderJs": true,
  "scrollToBottom": true,
  "maxItems": 50
}

MultiOn:

  • Loads the page in a real browser (with JavaScript).
  • Scrolls to trigger lazy loading.
  • Returns a JSON array of objects with fields like name, price, colors, productUrl, imageUrl.

No user login, no scraping credentials, and no brittle selectors bolted onto Playwright.


Operational guardrails for safe on-behalf actions

Automating user accounts safely is not just “don’t store passwords.” You also need operational controls.

1. Explicit user consent and scopes

When a user connects a site, clearly define:

  • What you might do: “Place orders,” “Post tweets,” “Read wishlists.”
  • Under what constraints: “Max $200 per order,” “Post only between 9am–5pm.”

Store these scopes alongside the session_id. Before each MultiOn call, enforce:

  • Does this cmd fit the user’s allowed actions?
  • Is the value/time/location within their approved constraints?

2. Step mode for high-risk actions

For anything irreversible (purchases, deletions, posts), use Step mode:

  1. Run step: true and stop just before final confirmation.
  2. Pull back a summary of what’s about to happen (items, prices, text).
  3. Present it to the user for approval.
  4. Only then send the final confirmation cmd (still tied to the same session_id).

This is how you turn a powerful session into a safe, user-visible workflow instead of a black box.

3. Monitoring and anomaly detection

At scale, you want to know:

  • How many actions per user per day are being executed.
  • Which commands are failing due to login issues or security checks.
  • When you’re hitting API limits (e.g., MultiOn responses like 402 Payment Required).

Build basic metrics:

  • Per-session success/failure rate.
  • Most common error types (expired session, blocked page, payment required).
  • Volume of high-risk commands (purchases, posts).

Use these metrics to decide when to:

  • Force a user to re-authenticate (new session_id).
  • Throttle or pause automation until you re-verify permissions.

How this approach compares to legacy Playwright/Selenium stacks

If you’re currently maintaining Playwright or Selenium flows for user-on-behalf actions, you likely recognize these pain points:

  • Selector drift: Every UI tweak breaks your test and your production flows.
  • Session orchestration: You end up building your own “remote Chrome farm” with session pinning, containers, and proxy rotation.
  • Bot protection whack-a-mole: Headless browsers and test fingerprints trigger more challenges.

MultiOn essentially productizes the stable parts of that stack:

  • You send cmd + url to POST https://api.multion.ai/v1/web/browse.
  • You keep state via session_id instead of re‑logging every time.
  • You use Retrieve for structured JSON instead of hand-rolled scrapers.
  • You lean on secure remote sessions + native proxy support for “tricky bot protection” instead of inventing your own infrastructure.

And critically, you do all of this without turning third‑party passwords into an infrastructure problem.


Putting it together: a safe design checklist

If your goal is to safely automate actions on third‑party sites without handling user passwords directly, your design should satisfy:

  • No raw credentials stored: Users always log in via real browser UIs; your backend never sees passwords.
  • Session-based delegation: All automation is keyed off a session_id representing a secure remote browser session.
  • Scoped, revocable access: Users can revoke access by logging out or changing passwords; you can drop the session_id at any time.
  • Step mode for critical flows: High-risk actions require explicit user confirmation before final execution.
  • Structured data via Retrieve: When you need data, you get JSON arrays of objects from dynamic pages, not brittle HTML scraping.
  • Operational observability: Metrics and logs for session health, command success, and rate limiting (including responses like 402 Payment Required).

MultiOn’s Agent API, Retrieve, and Sessions + Step mode are built to give you these primitives out of the box: intent in, actions executed in a real browser, and structured JSON out—without ever turning third‑party passwords into part of your backend surface area.

If you structure your system around these primitives, you can safely let agents click, buy, and post on behalf of your users on the open web, while keeping credentials exactly where they belong: in the browser, under the user’s control.

Next Step

Get Started