Updated on 2024-04-10 GMT+08:00

Requesting Device Authorization

Function

This API is used to request device authorization.

URI

POST /v1/device/authorize

Request Parameters

Table 1 Parameters in the request body

Parameter

Mandatory

Type

Description

client_id

Yes

String

Unique ID of the client registered in the IAM Identity Center

client_secret

Yes

String

Secret string generated for the client to obtain authorization from services in subsequent calls

start_url

Yes

String

User Portal URL

Response Parameters

Status code: 200

Table 2 Parameters in the response body

Parameter

Type

Description

device_code

String

Device code used by the device to poll session tokens

expires_in

Integer

Expiration time of a device code (in seconds)

interval

Integer

Number of seconds the client must wait for between two attempts when polling a session

user_code

String

One-time user verification code. This operation is required when authorizing a device in use.

verification_uri

String

URI of the validation page for authorizing a device using the one-time user verification code

verification_uri_complete

String

Alternate URL that the client can use to automatically start the browser. This procedure skips the manual steps of the user accessing the validation page and entering the code.

Example Request

Requesting device authorization

POST https://{hostname}/v1/device/authorize

{
  "client_id" : "example_client_id",
  "client_secret" : "example_client_secret",
  "start_url" : "https://example-start.example.com/start/url"
}

Example Response

Status code: 200

Successful

{
  "device_code" : "1234567890123456789012345678901234567890123456789012345678901234",
  "expires_in" : 1684955360,
  "interval" : 10,
  "user_code" : "1234567890123456",
  "verification_uri" : "https://example-erification.example.com/erification/url",
  "verification_uri_complete" : "https://example-erification-complete.example.com/erification/url"
}

Status Codes

For details, see Status Codes.

Error Codes

For details, see Error Codes.