Authentication

The easiest way to handle authentication is to sync your local browser cookies (where you’re already logged in) to a Browser Profile in the Cloud. This lets you run tasks with your existing login states without managing credentials.

Sync Local Cookies to Cloud

Sync your local cookies where you’re already logged in:

$export BROWSER_USE_API_KEY=your_key && curl -fsSL https://browser-use.com/profile.sh | sh

This opens a browser where you log into your accounts. After syncing, you’ll receive a profile_id.

Make sure you’re logged into all the accounts you want to use before syncing.

View Your Synced Profiles

Visit https://cloud.browser-use.com/dashboard?tab=profiles to see all your synced local profiles.

Using Your Profile in Tasks

Once you have a profile_id, use it to run tasks with your authentication:

1. Create a Session with Your Profile

First, create a session using your synced profile. See the API reference for full details.

1import { BrowserUseClient } from "browser-use-sdk";
2
3const client = new BrowserUseClient({ apiKey: "bu_..." });
4
5// Create session with your synced profile
6const session = await client.sessions.createSession({
7 profileId: "profile_abc123" // Your synced profile ID
8});
9
10console.log(session.id); // session_xyz789

2. Create a Task with the Session

Now create a task using the session ID. See the API reference for full details.

1// Create task with the session containing your authentication
2const task = await client.tasks.createTask({
3 sessionId: session.id,
4 llm: "browser-use-llm",
5 task: "Go to my LinkedIn profile and get my connection count"
6});
7
8const result = await task.complete();
9console.log(result);

Complete Example

1import { BrowserUseClient } from "browser-use-sdk";
2
3const client = new BrowserUseClient({ apiKey: "bu_..." });
4
5// 1. Create session with synced profile
6const session = await client.sessions.createSession({
7 profileId: "profile_abc123"
8});
9
10// 2. Run authenticated tasks
11const task = await client.tasks.createTask({
12 sessionId: session.id,
13 llm: "browser-use-llm",
14 task: "Check my GitHub notifications"
15});
16
17const result = await task.complete();
18console.log(result);

Your profile preserves all login states, so subsequent tasks in the same session will remain authenticated.