Cubicle

Start a device sign-in

POST
/v1/auth/device

Starts the OAuth 2.0 device authorization flow (RFC 8628) that cubicle login uses, for clients that cannot receive a browser redirect: nothing calls back into the client, which only polls. It needs no credentials and no body, and each call starts a separate sign-in with new codes.

  1. Call this route. It returns a secret deviceCode for the client and a short userCode (XXXX-XXXX) for the person.
  2. Send the person to verificationUriComplete, the Dashboard's /device page with the code filled in, and show userCode so they can check that it matches. They sign in if needed and choose Authorize or Deny.
  3. Meanwhile, call Exchange a device code for a session with deviceCode every interval seconds (2), until it returns a session or fails, for at most expiresIn seconds (600).

The session belongs to the person who chose Authorize, whoever started the flow. Calls are rate limited per client address and across all clients before anything else runs; see Rate limits. Sign people in from your tool walks through the flow.

Response Body

The sign-in has started.

application/json
  1. response
deviceCode*string

The secret code the client polls with (jvd_…). Keep it secret: whoever holds it receives the session.

userCode*string

The code the person checks in the Dashboard: 8 consonants as XXXX-XXXX.

Match^[BCDFGHJKLMNPQRSTVWXZ]{4}-[BCDFGHJKLMNPQRSTVWXZ]{4}$
expiresIn*integer

Seconds until the codes expire: 600.

interval*integer

Seconds to wait between polls: 2.

verificationUri*string

The Dashboard's device page, without the code.

Formaturi
verificationUriComplete*string

The Dashboard's device page with userCode filled in. Send the person here.

Formaturi
Example Request
curl -X POST 'https://api.cubicle.sh/v1/auth/device'
Example Response
{  "deviceCode": "jvd_qRbPpKtAPzyMvWuZ4Pp_3fQxlO0lB7qDcE9E2MpjzJM",  "userCode": "BCDF-GHJK",  "expiresIn": 600,  "interval": 2,  "verificationUri": "https://app.cubicle.sh/device",  "verificationUriComplete": "https://app.cubicle.sh/device?user_code=BCDF-GHJK"}