tinyhumansai/openhuman · error · anyhow::Error
login token is required
Error message
login token is required
What it means
consume_login_token exchanges a one-time login token for a JWT; the token argument is empty, so there is nothing to send to the backend and the exchange is refused client-side.
Solutions
- Pass the one-time login token received from the auth flow
- Check for an empty or whitespace-only token before calling
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at src/api/rest.rs:516 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of tinyhumansai/openhuman@7491200858 (2026-08-17).
Data as JSON: /api/errors/ce62b0f0b78b0057.
Report an issue: GitHub.
Appendix: source
Thrown at src/api/rest.rs:516
let state = value
.get("state")
.and_then(Value::as_str)
.filter(|state| !state.is_empty())
.map(str::to_owned)
.context("missing state")?;
Ok(ConnectResponse { oauth_url, state })
}
/// Fetches the current authenticated user profile using the provided JWT.
pub async fn fetch_current_user(&self, bearer_jwt: &str) -> Result<Value> {
self.authed_json(bearer_jwt, Method::GET, "auth/me", None)
.await
}
/// Exchanges a one-time login token (e.g. from Telegram) for a long-lived JWT.
pub async fn consume_login_token(&self, login_token: &str) -> Result<String> {
let token = login_token.trim();
anyhow::ensure!(!token.is_empty(), "login token is required");
// Backend serves `POST /auth/login-token/consume` with the token in a JSON
// body `{ token, audience? }` and returns `{ success, data: { jwt } }`
// (see backend `routes/auth.ts`). The legacy
// `telegram/login-tokens/{token}/consume` path-param route was removed, so
// the old call 404'd and Telegram/OAuth-token login could never complete
// (WIRING_GAPS_AUDIT C1/C2).
let response = self
.sdk
.auth()
.consume_login_token(&tinyhumans_sdk::api::types::LoginTokenRequest {
token: token.to_string(),
})
.await
.context("consume login token through TinyHumans SDK")?;
let jwt = response
.get("jwt")
.and_then(Value::as_str)View on GitHub (pinned to 7491200858)