You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: add full auth flow and token storage diagrams to README
Move example section higher for better visibility and expand
authentication section with ASCII flow diagrams, browser-based
auth explanation, and encrypted token storage details.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: README.md
+110-6Lines changed: 110 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -101,16 +101,16 @@ Add to your MCP client's config (e.g. `~/Library/Application Support/Claude/clau
101
101
```
102
102
</details>
103
103
104
-
## Authenticate
105
-
106
-
Start your agent and say "setup robinhood" (or call `robinhood_browser_login` directly). Chrome will open to the real Robinhood login page — log in with your credentials and MFA. The session is cached and auto-restores for ~24 hours.
107
-
108
104
## Example
109
105
110
106
> "Buy 1 50-delta SPX call expiring tomorrow"
111
107
112
108

113
109
110
+
## Authenticate
111
+
112
+
Start your agent and say "setup robinhood" (or call `robinhood_browser_login` directly). Chrome will open to the real Robinhood login page — log in with your credentials and MFA. The session is cached and auto-restores for ~24 hours.
113
+
114
114
## MCP Tools (18)
115
115
116
116
All 18 tools work with every MCP-compatible agent.
Sessions are cached to `~/.rh-for-agents/session.enc` (AES-256-GCM encrypted, key in OS keychain). Authentication uses browser-based login — `robinhood_browser_login` opens Chrome to the real Robinhood login page where you handle MFA natively. After initial login, subsequent authentication is automatic until the token expires (~24 hours).
185
-
186
184
**MCP**: Call `robinhood_browser_login` to open Chrome and log in (works with all agents). After that, all tools auto-restore the cached session.
187
185
188
186
**Skills**: Run the `robinhood-setup` skill for guided browser login (Claude Code and OpenClaw).
The left path is the initial login (browser-based, user-interactive). The right path is the session restore (automatic, every tool call). When the cached access token is invalid, it attempts a silent refresh using the stored `refresh_token` (with `expires_in: 734000`~8.5 days). If refresh also fails, the user is directed back to browser login.
242
+
243
+
### Why Browser-Based Auth
244
+
245
+
The browser login is purely passive — Playwright never clicks buttons, fills forms, or predicts the login flow. It opens a real Chrome window, the user completes login entirely on their own (including whatever MFA Robinhood requires), and Playwright only intercepts the network traffic:
246
+
247
+
-`page.on("request")` captures `device_token` from POST body to `/oauth2/token`
248
+
-`page.on("response")` captures `access_token` + `refresh_token` from the 200 response
249
+
250
+
This design is resilient to Robinhood UI changes — it doesn't depend on any DOM selectors, page structure, or login step ordering. As long as the OAuth token endpoint exists, the interception works. `playwright-core` is used (not `playwright`) so no browser binary is bundled — it drives the user's system Chrome.
`Bun.secrets` stores tokens directly in the OS keychain — no intermediate encryption layer needed since the keychain itself provides encryption, access control, and tamper resistance. When `Bun.secrets` is unavailable (CI, headless servers), tokens fall back to a plaintext JSON file with a console warning.
0 commit comments