POST/v1/oauth/authorize
Stable2026-04-01Try it

OAuthAuthorizationService.Authorize

OAuth 授权

用户在同意页授权后生成授权码。

Authentication

支持组合OAuth 2.0
No identity
User identity
Org identity

Request body · AuthorizeRequest

字段类型必填描述
client_idstring——
redirect_uristring——
response_typestring—"code"
scopestring—空格分隔的 scope 列表
statestring—防 CSRF 的 state 值
code_challengestring—PKCE:base64url(SHA256(code_verifier))
code_challenge_methodstring—"S256"
noncestring—OIDC nonce (Core 1.0 §3.1.2.1)。可选。标准路径:在 /authorize 请求携带 nonce,平台会随授权码持久化,并在令牌交换时把同样的值原样塞回 id_token 的 nonce claim——调用方无需在 token 请求里重传。仅当 scope 包含 "openid" 时有意义;其它情况会被忽略。

Response

200 OK · AuthorizeResponse

字段类型必填描述
authorization_codestring——
redirect_uristring—完整的回调 URI(含 code 和 state)
statestring——

错误响应 · google.rpc.Status

非 2xx 响应均按 AIP-193 规范包装为google.rpc.Status,含 code /message /details 三段。details[].reason 是机器可读的具体错误原因码,可用于客户端分支处理。

字段类型必填描述
codeinteger (int32)—The status code, which should be an enum value of google.rpc.Code.
messagestring—A developer-facing error message.
detailsarray<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