更新时间:2024-06-29 GMT+08:00
分享

注册客户端

功能介绍

向IAM身份中心注册客户端,这允许客户端启动设备授权,输出应该持久化以便于身份验证请求重用。

URI

POST /v1/clients

请求参数

表1 请求Body参数

参数

是否必选

参数类型

描述

client_name

String

客户端名称。

最小长度:1

最大长度:1024

client_type

String

客户端的类型。该服务仅支持public作为客户端类型。

枚举值:

  • public

token_endpoint_auth_method

String

向令牌端点发送请求时所需的身份验证方法。

枚举值:

  • client_secret_post

scopes

Array of strings

客户端定义的作用域列表。授权后,此列表用于在授予访问令牌时限制权限。

grant_types

Array of strings

客户端可以在令牌端点使用的OAuth2.0授权类型数组。

枚举值:

  • urn:ietf:params:oauth:grant-type:device_code
  • authorization_code

response_types

Array of strings

客户端可以在授权端点使用的OAuth2.0授权类型数组。

枚举值:

  • code

响应参数

状态码: 200

表2 响应Body参数

参数

参数类型

描述

client_info

Object

包含客户端注册信息的对象。

表3 client_info

参数

参数类型

描述

authorization_endpoint

String

客户端可以请求授权的端点。

client_id

String

客户端应用唯一标识。

client_id_issued_at

Long

客户端标识符和客户端密钥的注册时间。

client_secret

String

为客户端生成的秘密字符串。客户端将使用此字符串在后续调用中获得服务的身份验证。

client_secret_expires_at

Long

客户端标识符和客户端密钥失效的时间。

token_endpoint

String

客户端可以在其中获取访问令牌的端点。

scopes

Array of strings

服务器为客户端注册的作用域列表。后续授权访问令牌时,权限都应该限制在此作用域列表的子集范围内。

请求示例

向IAM身份中心注册客户端。

POST https://{hostname}/v1/clients

{
  "client_name" : "exampleClient",
  "client_type" : "public",
  "token_endpoint_auth_method" : "client_secret_post",
  "scopes" : [ "openid" ],
  "grant_types" : [ "authorization_code", "urn:ietf:params:oauth:grant-type:device_code"],
  "response_types" : [ "code" ]
}

响应示例

状态码: 200

Successful

{
  "client_info" : {
    "authorization_endpoint" : "https://example-region-oidc.examplehh.com:443/v1/authorize",
    "client_id" : "example_client_id",
    "client_id_issued_at" : 1677175760,
    "client_secret" : "example_client_secret",
    "client_secret_expires_at" : 1684951760,
    "token_endpoint" : "https://example-region-oidc.examplehh.com:443/v1/tokens",
    "scopes" : [ "openid" ]
  }
}

状态码

请参见状态码

错误码

请参见错误码

分享:

    相关文档

    相关产品