POST /v1/auth/device/code
RFC 8628 device authorization request, used by `b3os login`. Show the user `user_code` and send them to `verification_uri` (or `verification_uri_complete`), then poll the token endpoint every `interval` seconds. `scope` is a space-separated list of the scopes the token should have (default `*`, limited at approval to the approver's). Too many device logins from one address get `429` with `error: rate_limited`.

Request Body required

application/json
client_id string REQUIRED
Enum: b3os-cli, b3os-mcp, b3os-sdk
scope string
Space-separated scopes.

Responses

200 The device and user codes.
application/json
device_code string REQUIRED
user_code string REQUIRED
verification_uri string (uri) REQUIRED
verification_uri_complete string (uri) REQUIRED
expires_in integer REQUIRED
interval integer REQUIRED
400 The device request is invalid (OAuth `invalid_request`).
401 Unknown client (`invalid_client`).
429 Too many device logins from this address (`rate_limited`, in the OAuth error shape). Wait `Retry-After` seconds. Polling the token endpoint faster than `interval` is `slow_down` (400), not this.
curl -X POST 'https://beta-api.b3os.org/v1/auth/device/code' \  -H 'Authorization: Bearer YOUR_API_TOKEN' \  -H 'Content-Type: application/json' \  -d '{  "client_id": "b3os-cli"}'
const response = await fetch('https://beta-api.b3os.org/v1/auth/device/code', {  method: 'POST',  headers: {      "Authorization": "Bearer YOUR_API_TOKEN",      "Content-Type": "application/json"  },  body: JSON.stringify({    "client_id": "b3os-cli"  })});const data = await response.json();console.log(data);
import requestsheaders = {    'Authorization': 'Bearer YOUR_API_TOKEN'}response = requests.post('https://beta-api.b3os.org/v1/auth/device/code', headers=headers, json={  "client_id": "b3os-cli"})print(response.json())
200 Response
{  "device_code": "GmRhmhcxhwAzkoEqiMEg_DnyEysNkuNhszIySk9eS",  "user_code": "WDJB-MJHT",  "verification_uri": "https://beta.b3os.org/app/device",  "verification_uri_complete": "https://beta.b3os.org/app/device?user_code=WDJB-MJHT",  "expires_in": 900,  "interval": 5}
Ask a question... ⌘I