X-Gateway-Auth-Url header
— the same contract the Lager CLI speaks.
The crate handles gated boxes transparently, in two modes.
CLI session reuse (zero config)
If you’ve runlager login <auth_url> on the machine, the crate picks up
that session automatically:
- Reads the CLI’s token store (
~/.lager_gateway_auth, overridable viaLAGER_GATEWAY_AUTH_FILE). - Attaches
Authorization: Bearerto every request — including debug-service traffic and UART Socket.IO handshakes. - Refreshes expired access tokens transparently.
- Learns which auth server fronts a box from the gateway’s discovery header on first contact, and retries the denied request within the same call.
LagerBox::from_env() just works:
Pinned token (CI)
On machines with no CLI login (CI runners), supply a token directly:LAGER_GATEWAY_TOKEN environment variable — no code change:
Errors
When a gateway asks for auth and no usable credential exists, calls fail withError::AuthRequired, which names the auth server to log into:
Environment variables
The full client/gateway contract (discovery header, auth server endpoints,
store schema, retry semantics) is specified in the monorepo at
docs/reference/gateway-auth-contract.md.
