跳转到主要内容

Documentation Index

Fetch the complete documentation index at: https://docs.mirobody.ai/llms.txt

Use this file to discover all available pages before exploring further.

access_token 30 天有效;客户端应在 过期前 24 小时内 主动续期,避免 401 中断业务。

端点

POST /oauth/token
Content-Type: application/x-www-form-urlencoded
grant_type=refresh_token&refresh_token=<refresh_token>&client_id=<任意 client_id 字符串>
注意:本端点用 OAuth 2.0 标准 form 编码,不是 JSONclient_id 字段必填(邮箱登录场景下可填任意非空字符串作为客户端标识,例如 app 包名)。

响应

OAuth 2.0 标准格式:
{
  "access_token":  "eyJhbGci...",
  "token_type":    "Bearer",
  "expires_in":    2592000,
  "refresh_token": "eyJhbGci...",
  "scope":         "mcp:read mcp:write"
}
  • HTTP 200 表示成功。
  • HTTP 401 expired_token 表示 refresh_token 已过期或被吊销,应清掉本地 token 重走 邮箱登录
  • 每次续期会同时下发新的 access_tokenrefresh_token,客户端应全部替换为新值。

错误响应

{ "error": "expired_token", "error_description": "..." }
常见错误:
  • invalid_client — 缺 client_id
  • expired_token — refresh_token 过期。
  • invalid_grant — refresh_token 不合法。

客户端策略建议

  • 本地缓存 access_token 与 expires_in;当剩余有效期 < 24h 时主动调本端点续期。
  • 收到 401 时先尝试用 refresh_token 续期一次;仍失败再清本地 token 重新登录。