POST /oauth/register

OAuth 2.0 动态客户端注册端点。客户端自助注册并获取 client_id、client_secret 和 registration_access_token。限流:同一IP每小时最多10次注册。参考:RFC 7591 §2 (Dynamic Client Registration Protocol)。

OAuth None application/json

请求体

Schema: service-oauth/internal/handler/dto.ClientRegistrationRequest

字段类型必填示例约束描述
redirect_uris array of

string

是 ['["https://app.example.com/callback"]'] items: 1–None 回调URI列表
application_type string 否 web 应用类型
client_name string 否 My Application 客户端名称
client_uri string 否 https://app.example.com 客户端主页URL
contacts array of

string

否 ['["admin@example.com"]'] 联系人
grant_types array of

string

否 ['["authorization_code"', '"refresh_token"]'] 授权类型
jwks string 否 JWKS文档
jwks_uri string 否 https://app.example.com/jwks.json JWKS URI
logo_uri string 否 https://app.example.com/logo.png Logo URL
policy_uri string 否 https://app.example.com/privacy 隐私政策URL
scope string 否 openid profile email 权限范围
software_id string 否 my-app-v1 软件ID
software_version string 否 1.0.0 软件版本
token_endpoint_auth_method string 否 client_secret_basic Token端点认证方法
tos_uri string 否 https://app.example.com/tos 服务条款URL

响应

状态描述Schema
201注册成功(含 client_id, client_secret, registration_access_token)。参考:RFC 7591 §2.1。service-oauth/internal/handler/dto.ClientRegistrationDetailResponse
400invalid_client_metadata:请求元数据无效(缺少 redirect_uris 等)。参考:RFC 7591 §2.3。service-oauth/internal/handler/dto.OAuthErrorResponse
429rate_limit_exceeded:注册频率超限,请稍后重试service-oauth/internal/handler/dto.OAuthErrorResponse
500server_error:注册客户端失败service-oauth/internal/handler/dto.OAuthErrorResponse

引用的 Schema

service-oauth/internal/handler/dto.ClientRegistrationDetailResponse

字段类型必填示例约束描述
code integer 否
data service-oauth/internal/handler/dto.ClientRegistrationResponse 否
message string 否
timestamp string 否

service-oauth/internal/handler/dto.ClientRegistrationResponse

OAuth 2.0 Dynamic Client Registration response (RFC 7591 §2.1)

字段类型必填示例约束描述
application_type string 否 web 应用类型
client_id string 否 01JNXXXXX... 客户端ID
client_id_issued_at integer 否 1715692800 客户端ID签发时间
client_name string 否 My Application 客户端名称
client_secret string 否 sec_abc123... 客户端密钥
client_secret_expires_at integer 否 0 客户端密钥过期时间(0=永不过期)
client_uri string 否 https://app.example.com 客户端主页URL
contacts array of

string

否 ['["admin@example.com"]'] 联系人
grant_types array of

string

否 ['["authorization_code"', '"refresh_token"]'] 授权类型
logo_uri string 否 https://app.example.com/logo.png Logo URL
policy_uri string 否 https://app.example.com/privacy 隐私政策URL
redirect_uris array of

string

否 ['["https://app.example.com/callback"]'] 回调URI列表
registration_access_token string 否 reg_abc123... 注册管理Token
registration_client_uri string 否 https://app.example.com/api/v1/oauth/register/app-123 注册管理URI
scope string 否 openid profile email 权限范围
token_endpoint_auth_method string 否 client_secret_basic 认证方法
tos_uri string 否 https://app.example.com/tos 服务条款URL

service-oauth/internal/handler/dto.OAuthErrorResponse

OAuth标准错误响应

字段类型必填示例约束描述
error string 否 invalid_request 错误码
error_description string 否 Missing required parameter 错误描述
error_uri string 否 https://docs.example.com/errors 错误URI
i18n_key string 否 error.oauth_invalid_request I18nKey 本地化键(AUTH-46①/U416):协议字段 error/error_description 保持 RFC 6749 §5.2 原样, 本字段是**附加**信息(omitempty;未知错误码不填),供前端/AI 客户端按键确定性渲染文案, 无需解析英文原文。仅出现在 JSON 错误体,不写入 302 错误重定向的查询串。
state string 否 state-123 状态