Skip to content

POST /v1/auth/device/code

Starts the device authorization flow for a CLI or another device without a browser. Show the verification URL and user code, then poll the token endpoint at the returned interval. No request fields are required; any supplied body is ignored.

photon.auth.device.authorize(input?: DeviceAuthorizeInput, options?: RequestOptions): Promise<DeviceAuthorizeOutput>
import { Photon } from "@photon-ai/api";

const photon = new Photon();
const result = await photon.auth.device.authorize();
{
  "device_code": "string",
  "expires_in": 0,
  "interval": 0,
  "user_code": "string",
  "verification_uri": "string",
  "verification_uri_complete": "string"
}

Returns

200 Verification details for the RFC 8628 device flow. The optional JSON or form body is ignored; the authorization client is selected by the server. DeviceAuthorizeResponse

device_codestringrequired

Opaque device code to exchange at POST /v1/auth/device/token while waiting for the user to authorize.

expires_innumberrequired

Lifetime of the device code and user code, in seconds.

intervalnumberrequired

Minimum number of seconds to wait between token polling requests.

user_codestringrequired

Code the user enters at verification_uri to authorize this device.

verification_uristringrequired

Browser URL where the user enters user_code and authorizes the device.

verification_uri_completestringrequired

Browser URL with user_code included, ready to open or encode as a QR code.