auth docs (#730)

* add docs

* note

* format
This commit is contained in:
Chris Tate
2026-03-12 00:54:19 -05:00
committed by GitHub
parent cc82dd137c
commit f2d4089284
6 changed files with 254 additions and 8 deletions
+44
View File
@@ -57,6 +57,50 @@ The profile directory stores:
- Browser cache
- Login sessions
## Import auth from your browser
If you are already logged in to a site in Chrome, you can grab that auth state and reuse it in agent-browser. This is the fastest way to bypass login flows, OAuth, SSO, or 2FA.
**Step 1:** Start Chrome with remote debugging:
```bash
# macOS
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" --remote-debugging-port=9222
# Linux
google-chrome --remote-debugging-port=9222
```
Log in to your target site(s) in this Chrome window.
`--remote-debugging-port` exposes full browser control on localhost. Any local process can connect. Only use on trusted machines and close Chrome when done.
**Step 2:** Connect and save the authenticated state:
```bash
agent-browser --auto-connect state save ./my-auth.json
```
**Step 3:** Use the saved auth in future sessions:
```bash
# Load auth at launch
agent-browser --state ./my-auth.json open https://app.example.com/dashboard
# Or load into an existing session
agent-browser state load ./my-auth.json
agent-browser open https://app.example.com/dashboard
```
Combine with `--session-name` so the imported auth auto-persists across restarts:
```bash
agent-browser --session-name myapp state load ./my-auth.json
# From now on, state auto-saves/restores for "myapp"
```
State files contain session tokens in plaintext. Add them to `.gitignore` and delete when no longer needed. For encryption at rest, see [State encryption](#state-encryption) below.
## Session persistence
Use `--session-name` to automatically save and restore cookies and localStorage across browser restarts: