Authorize a device code (browser /device page calls this)
POST
/api/v1/device/authorize
Authentication
API Key (cookie: better-auth.session_token)
Request Body
application/jsonuser_code
string
REQUIRED
Responses
200
Authorized — CLI will pick up the token on next poll
application/jsonok
boolean
REQUIRED
Enum:
trueclient_name
string
REQUIRED
401
Not signed in
404
Code not found or expired
409
Code already used
curl -X POST 'https://littledemo.com/api/v1/device/authorize' \ -H 'Authorization: Bearer YOUR_API_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "user_code": "string"}'
const response = await fetch('https://littledemo.com/api/v1/device/authorize', { method: 'POST', headers: { "Authorization": "Bearer YOUR_API_TOKEN", "Content-Type": "application/json" }, body: JSON.stringify({ "user_code": "string" })});const data = await response.json();console.log(data);
import requestsheaders = { 'Authorization': 'Bearer YOUR_API_TOKEN'}response = requests.post('https://littledemo.com/api/v1/device/authorize', headers=headers, json={ "user_code": "string"})print(response.json())
200
Response
{ "ok": true, "client_name": "<string>"}
API Playground
Try this endpoint
POST
/api/v1/device/authorize