身份与幂等

POST /api/oauth/state

启动 OAuth 授权流程并生成状态绑定

本页说明 Google 登录 intent=login:BFF 为每次流程生成 32 字节随机值的无填充 base64url browser_binding(43 字符;必须替换示例占位符,不能复用固定值),以加密 Secure/HttpOnly/SameSite=Lax 流程 Cookie 或服务端会话保存,并验证回调 state 和绑定。返回 flow_token、expires_at、authorization_url、redirect_uri。bind/verify 还需要原生登录会话及对应安全证明;非 Google 流程不使用 browser_binding。部分参数失败为 HTTP 200、success=false。

POST/api/oauth/state

身份验证

Authorizationstring

公开接口;无需 OneAster 凭据。

请求正文 · application/json

providerstring必填

已注册 OAuth 提供方标识;本页的 Google 登录流程使用 google,其他提供方行为需另行核对

intentstring必填

流程意图;Google 登录固定为 login

affstring

可选邀请码(仅 intent=login 有效,上限 32 字符)

browser_bindingstring

Google 流程必填:前端 BFF 生成的 32 字节随机值 base64url 绑定字符串(无填充)

JSON Schema
{
  "type": "object",
  "required": [
    "provider",
    "intent"
  ],
  "allOf": [
    {
      "if": {
        "properties": {
          "provider": {
            "const": "google"
          }
        },
        "required": [
          "provider"
        ]
      },
      "then": {
        "required": [
          "browser_binding"
        ]
      }
    }
  ],
  "properties": {
    "provider": {
      "type": "string",
      "description": "已注册 OAuth 提供方标识;本页的 Google 登录流程使用 google,其他提供方行为需另行核对"
    },
    "intent": {
      "type": "string",
      "enum": [
        "login",
        "bind",
        "verify"
      ],
      "description": "流程意图;Google 登录固定为 login"
    },
    "aff": {
      "type": "string",
      "maxLength": 32,
      "description": "可选邀请码(仅 intent=login 有效,上限 32 字符)"
    },
    "browser_binding": {
      "type": "string",
      "minLength": 43,
      "maxLength": 43,
      "pattern": "^[A-Za-z0-9_-]{43}$",
      "description": "Google 流程必填:前端 BFF 生成的 32 字节随机值 base64url 绑定字符串(无填充)"
    }
  },
  "additionalProperties": true
}