OAuthAuthorizationService.Authorize
OAuth 授权
用户在同意页授权后生成授权码。
Authentication
| 支持组合 | OAuth 2.0 |
|---|---|
| No identity | |
| User identity | |
| Org identity |
Request body · AuthorizeRequest
| 字段 | 类型 | 必填 | 描述 |
|---|---|---|---|
client_id | string | — | — |
redirect_uri | string | — | — |
response_type | string | — | "code" |
scope | string | — | 空格分隔的 scope 列表 |
state | string | — | 防 CSRF 的 state 值 |
code_challenge | string | — | PKCE:base64url(SHA256(code_verifier)) |
code_challenge_method | string | — | "S256" |
nonce | string | — | OIDC nonce (Core 1.0 §3.1.2.1)。可选。标准路径:在 /authorize 请求携带 nonce,平台会随授权码持久化,并在令牌交换时把同样的值原样塞回 id_token 的 nonce claim——调用方无需在 token 请求里重传。仅当 scope 包含 "openid" 时有意义;其它情况会被忽略。 |
Response
200 OK · AuthorizeResponse
| 字段 | 类型 | 必填 | 描述 |
|---|---|---|---|
authorization_code | string | — | — |
redirect_uri | string | — | 完整的回调 URI(含 code 和 state) |
state | string | — | — |
错误响应 · google.rpc.Status
非 2xx 响应均按 AIP-193 规范包装为google.rpc.Status,含 code /message /details 三段。details[].reason 是机器可读的具体错误原因码,可用于客户端分支处理。
| 字段 | 类型 | 必填 | 描述 |
|---|---|---|---|
code | integer (int32) | — | The status code, which should be an enum value of google.rpc.Code. |
message | string | — | A developer-facing error message. |
details | array<Any> | — | A list of messages that carry the error details. |
Examples
curl -X POST \
'https://api.appforges.com/v1/oauth/authorize' \
-H 'Authorization: Bearer $ACCESS_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"client_id": "string",
"redirect_uri": "string",
"response_type": "string",
"scope": "string",
"state": "string",
"code_challenge": "string",
"code_challenge_method": "string",
"nonce": "string"
}'OpenAPI spec v0.59.4 · synced 10/11/2026, 11:27:14 PM