Skip to content
BuildBase
HTTP API menu

Start a device authorization request

The RFC 8628 device authorization endpoint; the org comes from the org query parameter.

POST/api/v1/auth/oauth2/device_authorization

Sign-in
None at the router: the operation is public, or checks its own proof (a signature, a token in the body, a signed link).
Rate limit
Up to 500 requests every 3 seconds per IP address; up to 1,000 requests a minute per API key (some requests are not counted); up to 300 requests a minute per IP address; up to 30 requests a minute per oauthClientLimiterKey.

The RFC 8628 device authorization endpoint; the org comes from the org query parameter. The client authenticates with client_id and client_secret in the body or with HTTP Basic, and a public client (token_endpoint_auth_method none) by its client_id alone. Answers a device code, a user code and the hosted verification URI; 401 invalid_client on failed client authentication and 400 unauthorized_client when the client may not use the device code grant.

Request

Send the body as application/json or application/x-www-form-urlencoded. The body is optional.

Body

FieldTypeRequiredConstraintsDescription
client_idstring or number or boolean or nullNoat most 4096 characters-
client_secretstring or number or boolean or nullNoat most 4096 characters-
scopestring or number or boolean or nullNoat most 4096 characters-
resourceone of: string or number or boolean or null, array of stringNo--

Example request

Replace each YOUR_... value with your own.

curl -X POST "https://api.console.buildbase.app/api/v1/auth/oauth2/device_authorization" \
  -H "Content-Type: application/json" \
  -d '{
  "client_id": "YOUR_CLIENT_ID",
  "client_secret": "string",
  "scope": "string"
}'
const response = await fetch(
  'https://api.console.buildbase.app/api/v1/auth/oauth2/device_authorization',
  {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      client_id: 'YOUR_CLIENT_ID',
      client_secret: 'string',
      scope: 'string',
    }),
  }
);
if (!response.ok) {
  throw new Error(`${response.status}: ${await response.text()}`);
}
const data = await response.json();
import requests

response = requests.post(
    "https://api.console.buildbase.app/api/v1/auth/oauth2/device_authorization",
    json={
        "client_id": "YOUR_CLIENT_ID",
        "client_secret": "string",
        "scope": "string",
    },
    timeout=30,
)
response.raise_for_status()
data = response.json()

Responses

200 OK

OK

Example
{
  "device_code": "[REDACTED]",
  "expires_in": 600,
  "interval": 5,
  "user_code": "[REDACTED]",
  "verification_uri": "http://localhost:4103/v1/device?org=000000000000000000000001",
  "verification_uri_complete": "http://localhost:4103/v1/device?org=000000000000000000000001&user_code=[REDACTED]"
}

Any other status

Any other answer the handler sends itself (its own refusals). Not described yet.

Errors

Each refusal, what it means, and what to do. The request changed nothing.

400 Bad Request

What it means: The request was refused in the OAuth 2.0 error shape (RFC 6749 section 5.2): error is a code such as invalid_request, invalid_grant, unsupported_grant_type or invalid_scope, and error_description says why in words. Branch on error, never on the description.

What to do: Fix the field the body names in path (or read message) and send the request again. Nothing was changed.

Example
{
  "error": "string",
  "error_description": "string"
}

401 Unauthorized

What it means: Client authentication failed (RFC 6749 section 5.2): error is invalid_client. When the client sent its credentials with HTTP Basic, the answer carries a WWW-Authenticate header.

What to do: Send the credential this operation asks for (see Sign-in above), or sign in again if it expired. A valid credential is also refused when the role has no grant for the permission above.

Example
{
  "error": "string",
  "error_description": "string"
}

429 Too Many Requests

What it means: A rate limit in x-rateLimit was reached. retryAfter and the Retry-After header say how many seconds until the window resets.

What to do: Wait the number of seconds in the Retry-After header (also retryAfter in the body), then retry. Slow down repeated calls.

Example
{
  "success": false,
  "message": "string",
  "reason": "rate_limited",
  "retryAfter": 1
}