Device authorization
The device authorization grant lets a program that cannot show a sign-in page, such as the furnace CLI, obtain a personal access token. The program never sees the person's password or browser session: the person approves in a browser where they are signed in with Falcata ID, and the program collects a newly minted token.
The two endpoints need no authentication. The API index at GET /api/v1 lists them under auth.deviceAuthorization and auth.deviceToken.
Device authorization: 8 nodes and 10 connections at L2 Containers.
- CLI or other client (actor)
- Device code endpoint (service)
- Person (actor)
- Approval page (service)
- Approve or deny (service)
- Pending authorizations (store)
- Device token endpoint (service)
- Mint personal access token (service)
- CLI or other client connects to Device code endpoint (sync, Request code)
- Device code endpoint connects to Pending authorizations (sync, Pending)
- CLI or other client connects to Person (async, Shows code)
- Person connects to Approval page (sync, Opens link)
- Approval page connects to Approve or deny (sync, Approve)
- Approve or deny connects to Pending authorizations (sync, Approved)
- CLI or other client connects to Device token endpoint (sync, Poll)
- Device token endpoint connects to Pending authorizations (sync, Claim once)
- Device token endpoint connects to Mint personal access token (sync, Mint)
- Mint personal access token connects to CLI or other client (sync, access_token)
1. Request a device code
POST /api/v1/auth/device/code
Content-Type: application/json
{ "label": "my-laptop CLI", "scope": { "readOnly": true } }
Both fields are optional. label names the token that will be minted; it is cut to 64 characters and defaults to CLI. scope asks for a narrower token and has the same shape as a personal access token's scope (readOnly, namespaces, permissions). A malformed scope is refused with 400. The scope is not checked against anyone yet, because the requester is anonymous; it is checked against the person who approves.
The response uses the RFC 8628 field names:
{
"device_code": "…",
"user_code": "WDJB-MJHT",
"verification_uri": "<Falcata ID origin>/device",
"verification_uri_complete": "<Falcata ID origin>/device/WDJB-MJHT",
"expires_in": 600,
"interval": 5
}
device_codeis the client's secret for this flow. The server keeps only its SHA-256 hash.user_codeis eight characters, shown as two groups of four, from an alphabet without the easily confusedI,L,O,0and1. It is not a secret.verification_uri_completecarries the user code as a path segment, not a query parameter.- The code is valid for ten minutes; poll no more often than every
intervalseconds.
2. Show the code and open the browser
The client shows user_code and opens verification_uri_complete, or asks the person to open it. The furnace CLI prints the code and any requested scope, opens the link, and prints it for pasting if no browser opens.
The person must compare the code in the browser with the one the client shows before approving. A user code is short enough to guess; approving a code someone else started would hand that person a token for the approver's account (RFC 8628 section 5.3).
3. Approve or deny in the browser
The approval page looks the code up and shows its status (pending, approved, denied, consumed, expired, or not found), the client's label, its expiry and the requested scope. The person signs in if needed, then approves or denies.
- Approve and Deny both require a signed-in person, so an anonymous visitor cannot cancel someone else's pending login.
- Approval succeeds only while the code is pending and unexpired.
- If a scope was requested, approval fails unless the scope is well formed and within the approver's own permissions. The failure shows in the browser and the code stays pending, rather than being approved and then failing at mint time.
- Deny marks a pending code denied; on any other code it does nothing.
4. Poll for the token
POST /api/v1/auth/device/token
Content-Type: application/json
{ "device_code": "…" }
Until the code is resolved, the endpoint answers HTTP 400 with an RFC 8628 error:
error | Meaning | Client action |
|---|---|---|
authorization_pending | Not yet approved. | Wait interval seconds and poll again. |
access_denied | The person denied it. | Stop. |
expired_token | The code expired, was already used, or is unknown. | Stop and start over. |
A body that is not JSON, or has no device_code, gets a plain 400. The server also bounds how often a single device code can be polled.
When the code has been approved, the server mints a personal access token for the approver, with the client's label and the requested scope, marks the code consumed in the same transaction, and returns:
{ "access_token": "fpat_…", "token_type": "Bearer" }
The token is returned exactly once. Any later poll with the same device code gets expired_token. The client sends it as Authorization: Bearer <token>; GET /api/v1/auth/whoami shows who it belongs to and its scope.
Differences from a stock RFC 8628 server
- Request bodies are JSON, not form-encoded, and there is no
client_id. scopeis a JSON object, not a space-separated string, and it is validated against the approving person.- The token endpoint does not return
slow_down.
Endpoint detail is in /api/reference. For the CLI side of this flow see Set up the furnace CLI; for what the token can do, Personal access tokens and Permissions, entitlements and flags.