Start device authorization
Start device authorization: deviceAuthorize in the TypeScript, Python, Rust and Go clients.
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>photon.auth.device.authorize(input: DeviceAuthorizeInput | None = None, *, options: RequestOptions | None = None) -> models.DeviceAuthorizeResponseclient.device_authorize().await -> Result<ResponseValue<types::DeviceAuthorizeResponse>, Error<DeviceAuthorizeError>>client.Auth.Device.Authorize(ctx context.Context, opts ...RequestOption) (*DeviceAuthorizeResponse, error)import { Photon } from "@photon-ai/api";
const photon = new Photon();
const result = await photon.auth.device.authorize();from photon_api import Photon
photon = Photon()
result = photon.auth.device.authorize()use photon_ai_api::PhotonClientBuilder;
let client = PhotonClientBuilder::new().build()?;
let result = client
.device_authorize()
.await
.map_err(|error| format!("{error:?}"))?
.into_inner();import (
"context"
photonapi "github.com/photon-hq/api/packages/go"
)
ctx := context.Background()
client := photonapi.NewClient()
result, err := client.Auth.Device.Authorize(ctx)
if err != nil {
return err
}
_ = result{
"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
Opaque device code to exchange at POST /v1/auth/device/token while waiting for the user to authorize.
Lifetime of the device code and user code, in seconds.
Minimum number of seconds to wait between token polling requests.
Code the user enters at verification_uri to authorize this device.
Browser URL where the user enters user_code and authorizes the device.
Browser URL with user_code included, ready to open or encode as a QR code.