Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

docs: update sign-in troubleshooting for session credential handoff

Steven Enamakelb6f15364fa5d
diff --git a/AGENTS.md b/AGENTS.md
index 9b7cd1e1f1..004dbf6da7 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -20,6 +20,7 @@ Architecture: [overview](gitbooks/developing/architecture.md),
| `crates/openhuman-core/src/main.rs` | `openhuman-core` CLI |
| `crates/openhuman-embed/` | Typed library facade for embedding the core in another product |
| `crates/openhuman-rpc/` | Shared RPC contracts, response decoding, and HTTP client used by app and TUI |
+| `crates/openhuman-session/` | Host-side login/session owner (login-token exchange, `/auth/me`, current-user cache, credential handoff) used by app and TUI |
| `crates/openhuman-tui/` | Standalone terminal frontend |
| `tests/` | Rust integration and JSON-RPC tests |
| `gitbooks/` | Public product and contributor documentation |
@@ -342,7 +343,8 @@ Every TinyHumans backend request must carry a sanitized `x-sdk-name`:
- `BackendOAuthClient`
- `IntegrationClient`, except redirected file downloads
- `MedullaClient`, including its separate SSE handshake
-- desktop `GET /auth/me`
+- the host session owner's `POST /auth/login-token/consume` and
+ `GET /auth/me` (`crates/openhuman-session`, through `ClientHeaders`)
- the agent Langfuse ingestion request
Set `ProductIdentity` once during startup before building clients. Do not add
diff --git a/gitbooks/features/cloud-deploy.md b/gitbooks/features/cloud-deploy.md
index 1896cf8444..b48d50295d 100644
--- a/gitbooks/features/cloud-deploy.md
+++ b/gitbooks/features/cloud-deploy.md
@@ -405,24 +405,39 @@ Symptom: OAuth in the browser completes ("close this and return to the app"),
but the desktop then shows a sign-in error — while the **same** account signs in
fine on the local (embedded) runtime (issue #3025).
-Root cause is almost always the **remote** core, not the desktop. `auth_store_session`
-makes the core validate the fresh session token against the backend
-(`GET /auth/me`) before persisting it; on a cloud runtime that call runs on your
-server, so it fails if the remote core can't reach/authenticate the backend:
-
-- **`BACKEND_URL` unset or wrong.** It is required (see the env table above) and
- must be `https://api.tinyhumans.ai` for prod (or the staging URL). A missing
- value is the most common cause — one reporter's failure was exactly this.
-- **Backend unreachable from the server** (egress firewall, DNS, TLS interception)
- → the core sees a gateway/timeout on `/auth/me`.
-- **Outdated core.** Older cores predate `allowPendingBackendValidation` and
- validate synchronously with no grace; update the server to a current release.
-- **Wrong RPC token.** A token mismatch surfaces as HTTP 401 on `/rpc`; re-paste
- the token (see "Rotating the bearer token").
-
-Check the remote core logs for `Session validation failed (GET /auth/me)` and the
-status/reason. The desktop now reports a cloud-specific, actionable message for
-these instead of a generic "try again" (issue #3025).
+The desktop shell validates the fresh session token against the backend
+(`GET /auth/me`) itself and only then hands the credential to the core
+(`auth.set_credential`). On a cloud runtime that handoff travels to your
+server, so the usual causes are:
+
+- **Wrong RPC token or URL.** A token mismatch surfaces as HTTP 401 on `/rpc`;
+ re-paste the token (see "Rotating the bearer token") and check the URL.
+- **Outdated core.** Older cores predate `auth.set_credential`; the desktop
+ still sends the legacy `auth_store_session` name through an alias, but a
+ core older than that alias rejects the call. Update the server to a current
+ release.
+- **`BACKEND_URL` unset or wrong on the server.** The remote core does not
+ validate the session any more, but every backend call it makes on your
+ behalf (billing, teams, managed inference) still goes there. It must be
+ `https://api.tinyhumans.ai` for prod (or the staging URL).
+
+Check the desktop log for the shell's session-owner lines (`[session]`) and
+the remote core log for `[credentials][set-credential]`. The desktop reports a
+cloud-specific, actionable message for these instead of a generic "try again"
+(issue #3025).
+
+### Headless sign-in
+
+A cloud core has no browser to complete OAuth in. Obtain a credential
+elsewhere and hand it to the core at boot:
+
+- `OPENHUMAN_BACKEND_API_KEY=<key>` — a TinyHumans API key (recommended; no
+ user identity, nothing to expire).
+- `OPENHUMAN_BACKEND_SESSION_TOKEN=<jwt>` — a session JWT with a subject claim.
+
+Either installs the credential only when the store has none of that kind; to
+rotate, clear first (`openhuman-core auth clear_credential --kind api-key`).
+The same operation is available over RPC as `openhuman.auth_set_credential`.
---
diff --git a/gitbooks/overview/troubleshooting-sign-in.md b/gitbooks/overview/troubleshooting-sign-in.md
index f292c2e89b..90680211a8 100644
--- a/gitbooks/overview/troubleshooting-sign-in.md
+++ b/gitbooks/overview/troubleshooting-sign-in.md
@@ -39,7 +39,7 @@ Successful desktop OAuth ends with an `openhuman://auth?...` callback. If the br
1. Make sure only one OpenHuman desktop instance is running.
2. Restart the app, keep the same remote-core settings, and retry sign-in.
-3. If using a remote core, check whether the core receives `openhuman.auth_store_session`.
+3. If using a remote core, check whether the core receives `openhuman.auth_set_credential` (the desktop shell validates the session against the backend first, then hands the credential to the core).
## Windows: `openhuman://` handler not registered
@@ -65,13 +65,13 @@ Set-ItemProperty -Path 'HKCU:\Software\Classes\openhuman\shell\open\command' -Na
Restart OpenHuman afterwards and retry sign-in. If `register_all_error` is non-`None` in the log (for example because antivirus or a locked-down image is blocking writes to `HKCU\Software\Classes`), fixing the underlying policy is required; the manual script above will hit the same block.
-For a remote core, a temporary manual injection can confirm the core is otherwise healthy:
+For a remote core, a temporary manual injection can confirm the core is otherwise healthy (the core stores the credential as given; supply the user id the token belongs to unless the JWT carries a subject claim):
```bash
curl -sS https://your-core.example/rpc \
-H "Content-Type: application/json" \
-H "Authorization: Bearer CORE_TOKEN" \
- -d '{"jsonrpc":"2.0","id":1,"method":"openhuman.auth_store_session","params":{"token":"JWT_FROM_CALLBACK"} }'
+ -d '{"jsonrpc":"2.0","id":1,"method":"openhuman.auth_set_credential","params":{"token":"JWT_FROM_CALLBACK","userId":"YOUR_USER_ID"} }'
```
Do not paste real JWTs into public GitHub issues. Redact tokens and attach only status codes, hostnames, app version, OS, and the relevant log lines.