创建 OAuth2 应用,服务端生成 client_id;confidential 类型同时生成 client_secret,且 client_secret 仅在本次响应中返回一次,请妥善保存。public 类型无 client_secret,授权时必须使用 PKCE。redirect_uris 规则:1~10 个;必须是绝对 URL;仅允许 https,http 仅限回环地址(localhost/127.0.0.1/::1);不得包含 fragment(#);不得重复。成功返回 HTTP 201。
鉴权:需要用户 JWT(Authorization: Bearer )
OAuth2:不允许使用 OAuth2 Access Token 调用
错误响应:
| code | msg |
|---|---|
| 401 | authorization header is missing |
| 401 | authorization header format must be Bearer {token} |
| 401 | invalid token |
| 401 | token has been revoked |
| 503 | token validation temporarily unavailable |
| 403 | 此接口不支持OAuth2访问 |
| 400 | 请求参数错误: <校验错误详情> |
| 400 | 重定向URI不合法: redirect_uri cannot be empty |
| 400 | 重定向URI不合法: at most 10 redirect_uris are allowed |
| 400 | 重定向URI不合法: redirect_uri must be an absolute URL |
| 400 | 重定向URI不合法: redirect_uri must use https (http is only allowed for loopback addresses) |
| 400 | 重定向URI不合法: redirect_uri must not contain a fragment |
| 400 | 重定向URI不合法: redirect_uris contains duplicates |
| 500 | 生成客户端ID失败 |
| 500 | 生成客户端密钥失败 |
| 500 | 序列化重定向URI失败 |
| 500 | 创建应用失败 |