All Products
Search
Document Center

Identity as a Service:GenerateDeviceCode

Last Updated:Jul 31, 2025

Generates a device code.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

There is currently no authorization information disclosed in the API.

Request syntax

POST /v2/{instanceId}/{applicationId}/oauth2/device/code HTTP/1.1

Request parameters

ParameterTypeRequiredDescriptionExample
instanceIdstringYes

The instance ID.

idaas_ue2jvisn35ea5lmthk267xxxxx
applicationIdstringYes

The application ID.

app_mkv7rgt4d7i4u7zqtzev2mxxxx
scopestringNo

The authorization scope.

xxx

Response parameters

ParameterTypeDescriptionExample
object

The response parameters.

device_codestring

The device code.

xxxxx
user_codestring

The user authorization code.

xxxxx
verification_uristring

The verification URI.

https://example.com/authorize/device
verification_uri_completestring

The complete verification URI.

https://example.com/authorize/device?user_code= xxxx
expires_inlong

The remaining validity period of the device code. Unit: seconds.

1200
expires_atlong

The time when the token expires. This value is a UNIX timestamp representing the number of seconds that have elapsed since January 1, 1970, 00:00:00 UTC.

1653288641
intervallong

The timeout period of the request token. Unit: seconds.

5

Examples

Sample success responses

JSONformat

{
  "device_code": "xxxxx",
  "user_code": "xxxxx",
  "verification_uri": "https://example.com/authorize/device",
  "verification_uri_complete": "https://example.com/authorize/device?user_code=\nxxxx",
  "expires_in": 1200,
  "expires_at": 1653288641,
  "interval": 5
}

Error codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2023-10-24The internal configuration of the API is changed, but the call is not affectedView Change Details