获取OAuth2客户端
更新时间:2026-07-14
获取OAuth2客户端
- 根据客户端记录 ID 获取详情(get 返回 clientSecret 明文,含 loginUrl)。
OpenAPI Explorer
去调试
您可以在 OpenAPI Explorer 中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer 可以自动生成 SDK 代码示例。
请求结构
Plain Text
1POST /v{version}/agent-identity/user-pool/oauth2-client/get HTTP/1.1
2Host: identity.baidubce.com
3Authorization: authorization string
请求头域
除公共头域外,无其他特殊头域
请求参数
| 参数名称 | 类型 | 是否必需 | 参数位置 | 描述 |
|---|---|---|---|---|
| version | String | 是 | URL参数 | API版本号 |
| userPoolId | String | 是 | RequestBody参数 | 用户池 ID |
| id | String | 是 | RequestBody参数 | 客户端记录 ID |
返回状态码
成功返回200,失败返回见错误码
返回头域
除公共头域外,无其他特殊头域
返回参数
| 参数名称 | 类型 | 描述 |
|---|---|---|
| id | String | 客户端记录 ID |
| clientId | String | OAuth2 client_id |
| clientSecret | String | client_secret(get 返回明文,list 不返回) |
| name | String | 客户端名称 |
| description | String | 描述 |
| clientType | String | 客户端类型:WEB_APP / SPA / M2M |
| redirectUris | List |
回调地址白名单 |
| grantTypes | List |
授权类型 |
| scopes | List |
允许的 scope |
| accessTokenTtl | Integer | access_token 有效期(秒) |
| refreshTokenTtl | Integer | refresh_token 有效期(秒) |
| enabled | Boolean | 是否启用 |
| loginUrl | String | 拼装好的 OAuth2 authorize 链接 |
| createdAt | DateTime | 创建时间 |
请求示例
Plain Text
1{
2 "userPoolId": "string",
3 "id": "string"
4}
返回示例
Plain Text
1{
2 "id": "01961d4e5f6a7b8c9012def345678901",
3 "clientId": "ai_AbCdEf1234567890GhIjKl",
4 "clientSecret": "xY9mN2pQ5rT8vW1zA4cF7hJ0kL3oS6u",
5 "name": "dumate-web",
6 "description": null,
7 "clientType": "WEB_APP",
8 "redirectUris": ["https://dumate.app/callback"],
9 "grantTypes": ["authorization_code"],
10 "scopes": ["openid"],
11 "accessTokenTtl": 3600,
12 "refreshTokenTtl": 604800,
13 "enabled": true,
14 "loginUrl": "https://identity.bce.baidu.com/v1/agent-identity/inbound/01961a2b3c4d5e6f7890abcdef123456/authorize?response_type=code&client_id=ai_AbCdEf1234567890GhIjKl&scope=openid+profile+offline_access&redirect_uri=https%3A%2F%2Fdumate.app%2Fcallback",
15 "createdAt": "2025-06-01T00:00:00Z"
16}
评价此篇文章
