Skip to main content
POST
/
auth
/
device-codes
Request device code
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({clientID: 'abc123xyz'})
};

fetch('https://api.discovr.media/auth/device-codes', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
{
  "deviceCode": "dvc_abc123xyz789",
  "userCode": "1234",
  "authQRCode": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...",
  "expiresIn": 600000
}

Documentation Index

Fetch the complete documentation index at: https://docs.discovr.media/llms.txt

Use this file to discover all available pages before exploring further.

Query Parameters

size
integer
default:300

QR code size in pixels. Larger sizes are recommended for TV displays.

Required range: 100 <= x <= 1000
format
enum<string>
default:json

Response format. Use "image" for native clients to receive binary PNG directly.

Available options:
json,
image

Body

application/json
clientID
string
required

The client ID of the third-party application. Identifies the application requesting device authorization.

Example:

"abc123xyz"

Response

Device code created successfully. Response format depends on format query parameter.

Response when format=json (the default). With format=image the response is a binary PNG instead.

deviceCode
string
required

Unique identifier for this authorization request. Used when polling.

Example:

"dvc_abc123xyz789"

userCode
string
required

Short user-friendly code to display. The user enters this on another device to authorize the sign-in.

Pattern: ^[0-9]{4}$
Example:

"1234"

authQRCode
string<uri>
required

Base64 PNG QR code (data URL). Encodes the authorization URL + userCode for easy scanning. Only present when format=json.

Example:

"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA..."

expiresIn
integer
required

Device-code expiry, in milliseconds.

Example:

600000