GenerateDeviceCode - 生成设备Code

更新时间: 2024-03-03 14:06:01

调用GenerateDeviceCode接口,生成设备流code。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

授权信息

当前API暂无授权信息透出。

请求语法

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

请求参数

名称类型必填描述示例值
instanceIdstring

实例 ID。

idaas_ue2jvisn35ea5lmthk267xxxxx
applicationIdstring

应用 ID。

app_mkv7rgt4d7i4u7zqtzev2mxxxx
scopestring

scope 范围。

xxx

返回参数

名称类型描述示例值
object

响应结果。

device_codestring

设备码。

xxxxx
user_codestring

用户授权码。

xxxxx
verification_uristring

检验 uri。

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

完整的检验 uri。

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

有效时长,单位秒

1200
expires_atlong

失效时间,格式为 Unix 时间戳,单位为秒。

1653288641
intervallong

请求 token 节点的超时时间,单位秒

5

示例

正常返回示例

JSON格式

{
  "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
}

错误码

访问错误中心查看更多错误码。

变更历史

变更时间变更内容概要操作
2023-10-24API 内部配置变更,不影响调用看变更集
变更项变更内容
API 内部配置变更,不影响调用

错误码

HttpCodeError Code错误信息说明
400invalid_requestApplication is not turn device grant flow on设备流授权未开启
400invalid_requestInvalid client idclient id 无效
404application_not_foundApplication id not found: app_mkv7rgt4d7i4u7zqtzev2mxxxx应用不存在
500Internal Server ErrorInternal Server Error服务器内部错误
阿里云首页 应用身份服务 (IDaaS) 相关技术圈