/oauth/authorize
OAuth 2.0 授权端点(POST 方式)。用户确认授权后,提供 redirect_uri 时返回 302 重定向;未提供时返回 JSON 授权码。支持 PKCE、PAR 和 consent 自动保存。参考:RFC 6749 §4.1.1-4.1.2.1 (Authorization Code Grant)、RFC 7636 (PKCE)、RFC 9126 (PAR)。
Request Body
Accepts an empty JSON object {}
Responses
| Status | Description | Schema |
|---|---|---|
| 200 | 授权码(无 redirect_uri 时) | handler.authorizeCodeResponse |
| 302 | 重定向到回调URL并附带 OAuth 错误(invalid_request/invalid_client/access_denied) | string |
| 400 | invalid_request_uri:PAR 请求无效/过期/已使用。参考:RFC 9126。 | dto.OAuthErrorResponse |
| 403 | access_denied:user_id 与认证用户不匹配 | dto.OAuthErrorResponse |
| 500 | server_error:授权服务器内部错误。参考:RFC 6749 §5.2。 | dto.OAuthErrorResponse |
Referenced Schemas
dto.OAuthErrorResponse
OAuth标准错误响应
| Field | Type | Required | Example | Constraints | Description |
|---|---|---|---|---|---|
error |
string |
No | invalid_request |
错误码 | |
error_description |
string |
No | Missing required parameter |
错误描述 | |
error_uri |
string |
No | https://docs.example.com/errors |
错误URI | |
state |
string |
No | state-123 |
状态 |
handler.authorizeCodeResponse
| Field | Type | Required | Example | Constraints | Description |
|---|---|---|---|---|---|
code |
string |
No | |||
state |
string |
No |