hasp login flows use a browser redirect with a local loopback listener (see OAuth Quickstart). That doesn’t work over SSH, in a container, or on a machine with no browser. The device authorization grant (RFC 8628) is the fallback: the CLI displays a short code, you enter it on any other device with a browser, and the CLI polls for completion.
This is a hasp CLI concern, not something most API integrators need to implement directly — it’s documented here because the two endpoints it uses are part of the public /v1 OAuth surface.
Flow overview
- The CLI (auto-detecting no browser/loopback available) requests a device code.
- It shows you a short
user_codeand a URL to visit. - You open the URL on any device, sign in, and approve.
- Meanwhile the CLI polls the token endpoint until you approve (or the code expires).
1. Request a device code
An unknown or inactive
client_id returns a 400 with the standard RFC 6749 shape: {"error": "invalid_client", "error_description": "..."}.
2. User approves
Direct the user toverification_uri_complete (or verification_uri + manually entering user_code). This is a normal authenticated, session-based HASP page — the user signs in if needed, sees the code, and approves or denies.
3. Poll the token endpoint
interval seconds (the value returned in step 1). While the user hasn’t approved yet, every poll returns:
Polling error codes (RFC 8628 §3.5)
Security notes
user_codeis short and human-facing by design (RFC 8628’s threat model accepts this given the 15-minute expiry and the fact that guessing it grants nothing without also completing an authenticated approval step).device_codeis long, unguessable, and never displayed — only ever transmitted machine-to-machine between the CLI and the token endpoint.- A device code is single-use: once exchanged for a token (or denied), polling it again returns
invalid_grant.