Google OAuth 回调接收。必须使用 POST;原生 GET /api/oauth/google 固定返回 405 Method Not Allowed。后端 POST URL 不接受查询参数;前端 GET 回调临时收到 code/state 后须校验并清理,不将其持久化到日志。由前端 BFF 在验证本站流程 Cookie 后将 state(flow_token)、code(Google 授权码)及 browser_binding 封装在 JSON 请求体中转发;用户拒绝时传 error。成功返回原生 AuthBundle 并设置 new_api_refresh Cookie;如已启用 MFA,返回 require_verification: true,需继续调用 POST /api/user/login/verify 完成二次验证。
POST
/api/oauth/google身份验证
Authorizationstring公开接口;无需 OneAster 凭据。
请求正文 · application/json
statestring必填从 POST /api/oauth/state 获得的 flow_token
codestringGoogle 回调返回的授权码(与 error 二选一)
errorstringGoogle 拒绝或取消时的错误码(与 code 二选一)
browser_bindingstring必填原流程保存在 Cookie 中的 32 字节 base64url 浏览器绑定值
JSON Schema
{
"type": "object",
"required": [
"state",
"browser_binding"
],
"oneOf": [
{
"required": [
"code"
],
"not": {
"required": [
"error"
]
}
},
{
"required": [
"error"
],
"not": {
"required": [
"code"
]
}
}
],
"properties": {
"state": {
"type": "string",
"description": "从 POST /api/oauth/state 获得的 flow_token"
},
"code": {
"type": "string",
"minLength": 1,
"maxLength": 4096,
"description": "Google 回调返回的授权码(与 error 二选一)"
},
"error": {
"type": "string",
"minLength": 1,
"maxLength": 128,
"description": "Google 拒绝或取消时的错误码(与 code 二选一)"
},
"browser_binding": {
"type": "string",
"minLength": 43,
"maxLength": 43,
"pattern": "^[A-Za-z0-9_-]{43}$",
"description": "原流程保存在 Cookie 中的 32 字节 base64url 浏览器绑定值"
}
},
"additionalProperties": false
}