# Keep your AI agent signed in to websites

> Sign in once yourself, in a real window. Dejo keeps the session, so your agent starts signed in every time and never sees your password.

Canonical: https://dejo.run/docs/sign-in

> For AI agents: the index of this site is https://dejo.run/llms.txt, and every page is also served as markdown (add .md to its address, or send Accept: text/markdown).

**The short answer:** sign in once yourself, in a real browser window. Dejo keeps the session in its own browser profile, so your agent starts signed in every time, and it never sees your password.

This works for every kind of sign-in: a password, "Sign in with Google", a company SSO page, or a code sent to your phone.

## Sign in once

Ask your agent to do something on the site. If the site wants a sign-in, your agent calls `dejo_login` and a real browser window opens on that site (Chrome if you have it, otherwise the Chromium Dejo installed). Sign in there however the site asks, in your own time, then tell your agent you are done. It calls `dejo_login` again with `done: true` and the window closes.

From a terminal, the same thing is:

```bash
dejo login --site posthog.com
```

Sign in in the window, then press Enter in the terminal.

## Dejo checks that you really signed in

Before it closes the window, Dejo looks at it. If the page still looks like a sign-in page (the address has `/login`, `/signin`, `/auth`, `/sso` or `/oauth` in it, or a password box is showing), nothing is closed and nothing is saved. Your agent is told to ask you to finish.

If you have looked and you **are** signed in, your agent can call `dejo_login` with `done: true` and `confirmed: true`.

A sign-in that did not happen is never recorded as one.

## What Dejo keeps, and what it doesn't

| kept | not kept |
|---|---|
| the browser session (cookies and site storage), in `~/.dejo/browser-profile` | your password |
| the fact "this site needs a sign-in" | any one-time code |
| | how you signed in |

The session lives on your machine, in Dejo's own browser profile. It is not your everyday Chrome profile, so nothing in your own browser is touched.

## Several accounts on one site

Some sites have more than one kind of user: a customer, a vendor, an admin. Give each one its own **profile** before signing in. A profile is a whole signed-in browser of its own, so all of them stay signed in side by side.

From your agent:

- `dejo_profile("vendor")` switches to the vendor profile (and makes it the first time).
- `dejo_login` then signs in **that** profile only.
- `dejo_profile()` with no name lists the profiles and says which one is in use.

From a terminal:

```bash
dejo --profile vendor login --site shop.example.com
dejo --profile admin  login --site shop.example.com
```

You never sign out and back in between roles, so a set of tests covering three roles no longer depends on the order they run in. Every `dejo_run` result names the profile it ran as.

What your agent learns about a site is shared by all profiles on purpose: it is one site, however many accounts reach it.

## Sites where your agent types the password

Some sites have a plain password form, and you may want your agent to fill it on every run. Dejo still never stores the password. The saved step says only that a password goes there, and the value is read at run time from one of two places:

1. An environment variable named after the site and the field:

   ```bash
   DEJO_SECRET_BILLING_ACME_COM_PASSWORD=your-password
   ```

2. Or the file `~/.dejo/secrets.json`:

   ```json
   { "billing.acme.com": { "password": "..." } }
   ```

For one profile only, add the profile name: `DEJO_SECRET_BILLING_ACME_COM_ADMIN_PASSWORD`, or `{ "billing.acme.com": { "admin": { "password": "..." } } }` in the file.

If the value is missing, the run stops and names the exact variable to set. It never guesses and never uses something stored earlier.

## When a session runs out

Websites end sessions on their own schedule. When that happens, the next `dejo_run` comes back with `needs_login`. Sign in once more, the same way, and the route carries on.

If a page times out in a profile but loads fine in a fresh browser, Dejo says the profile is stuck instead of blaming the website. See [Troubleshooting](https://dejo.run/docs/troubleshooting#nothing-loads-in-dejos-browser-profile).

## How this compares with Playwright MCP

[Playwright MCP](https://playwright.dev/mcp/configuration/user-profile) also keeps you signed in: by default its browser profile persists between sessions. It gives you a few ways to handle sign-in:

| | Playwright MCP | Dejo |
|---|---|---|
| keeps the session between chats | yes, a persistent profile by default | yes, a persistent profile |
| several accounts on one site | one profile per project folder; switch with `--user-data-dir` or `--storage-state` files | named profiles side by side, switched with `dejo_profile` |
| Google, SSO, one-time codes | the [browser extension](https://playwright.dev/mcp/configuration/browser-extension) reuses your own signed-in Chrome | a window opens and you sign in once |
| checks the sign-in really happened | no | yes, before the window closes |
| password for a form, without the AI seeing it | not built in | `DEJO_SECRET_…` variable or `secrets.json` |
| remembers the task after signing in | no | yes, the next run is one call |

Playwright MCP's extension is a good choice when you want the agent inside your everyday browser, with all its sign-ins. Dejo keeps its own browser instead, so your agent never touches your personal tabs. For Claude in Chrome as well, see [can Claude log in to websites?](https://dejo.run/blog/can-claude-log-in-to-websites), which compares all three.

## On a server with no screen

Signing in needs a window that a person can see, so it cannot happen over plain SSH or in a container. Sign in on a computer with a desktop and copy `~/.dejo/browser-profile` across, or forward a display with `ssh -X`. Runs after that are headless and need no screen.


## FAQ

## FAQ

### Does Dejo store my password?

No. You sign in yourself, in a real browser window. Dejo keeps only the browser session, the same way your own browser does. A step that types a password records only that a password goes there; the value is read at run time from an environment variable or a local secrets file.

### Can my agent sign in with Google or SSO for me?

No, and it should not. Dejo never automates a Google, SSO or one-time-code sign-in. It opens a window, you sign in there, and the session is kept from then on.

### How long does the sign-in last?

As long as the website keeps the session, the same as in your own browser. When the site signs you out, the next run comes back with needs_login and you sign in once more.

### If I make Dejo forget a site, am I signed out?

No. Forgetting removes the route, not the session. To sign out, delete the profile folder.

## Related

- [Dejo MCP server setup: install in a minute](https://dejo.run/docs)
- [Browser automation in Claude Code: add a browser MCP](https://dejo.run/docs/claude-code)
- [Browser automation in Codex: the config.toml setup](https://dejo.run/docs/codex)
- [Cursor browser automation with a browser MCP](https://dejo.run/docs/cursor)
- [When a website changes: how Dejo replays safely](https://dejo.run/docs/when-the-site-changes)
- [Dejo MCP tools reference](https://dejo.run/docs/tools)
- [Troubleshooting Dejo](https://dejo.run/docs/troubleshooting)
