POST /v1/auth/device/token
RFC 8628 device access token request. Until the user approves, answers `400` with `authorization_pending` (or `slow_down` when you poll faster than `interval`: add 5 seconds to it). After approval returns a `b3os_pat_` token once; the device code then stops working. Errors use the OAuth shape `{error, error_description}`; too many polls from one address get `429` with `error: rate_limited`.

Request Body required

application/json
grant_type string REQUIRED
Enum: urn:ietf:params:oauth:grant-type:device_code
device_code string REQUIRED
client_id string REQUIRED

Responses

200 The token.
application/json
access_token string REQUIRED
token_type string REQUIRED
Enum: Bearer
expires_in integer REQUIRED
scope string REQUIRED
org_id string REQUIRED
project_id string REQUIRED
400 Not approved yet, polling too fast, denied, expired or already used (`authorization_pending`, `slow_down`, `access_denied`, `expired_token`, `invalid_grant`).
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/token' \  -H 'Authorization: Bearer YOUR_API_TOKEN' \  -H 'Content-Type: application/json' \  -d '{  "grant_type": "urn:ietf:params:oauth:grant-type:device_code",  "device_code": "GmRhmhcxhwAzkoEqiMEg_DnyEysNkuNhszIySk9eS",  "client_id": "b3os-cli"}'
const response = await fetch('https://beta-api.b3os.org/v1/auth/device/token', {  method: 'POST',  headers: {      "Authorization": "Bearer YOUR_API_TOKEN",      "Content-Type": "application/json"  },  body: JSON.stringify({    "grant_type": "urn:ietf:params:oauth:grant-type:device_code",    "device_code": "GmRhmhcxhwAzkoEqiMEg_DnyEysNkuNhszIySk9eS",    "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/token', headers=headers, json={  "grant_type": "urn:ietf:params:oauth:grant-type:device_code",  "device_code": "GmRhmhcxhwAzkoEqiMEg_DnyEysNkuNhszIySk9eS",  "client_id": "b3os-cli"})print(response.json())
200 Response
{  "access_token": "b3os_pat_ex4mple7ex4mple7ex4mple7ex4mple7_13cd7b34",  "token_type": "Bearer",  "expires_in": 7776000,  "scope": "*",  "org_id": "org_01m5t5hthd29mm5wpza5ndd6mm",  "project_id": "prj_01m5t3pf8heewxt65ej3dm577y"}
Ask a question... ⌘I