登出

OpenAPI 契约

方法
POST
路径
/api/v1/auth/logout
认证
jwtBearer (bearer)
响应状态
200 400 401 403 429 500
请求与响应 Schema
JSON
{
  "requestBody": {
    "application/json": {
      "$ref": "#/components/schemas/LogoutRequest"
    }
  },
  "responses": {
    "200": {
      "description": "Session ended",
      "content": {
        "application/json": {}
      }
    },
    "400": {
      "description": "Invalid request",
      "content": {
        "application/json": {
          "$ref": "#/components/schemas/RequestError"
        }
      }
    },
    "401": {
      "description": "Authentication required or invalid",
      "content": {
        "application/json": {
          "$ref": "#/components/schemas/SecurityError"
        }
      }
    },
    "403": {
      "description": "Authenticated but not permitted",
      "content": {
        "application/json": {
          "$ref": "#/components/schemas/SecurityError"
        }
      }
    },
    "429": {
      "description": "Rate limit exceeded",
      "content": {
        "application/json": {
          "$ref": "#/components/schemas/SecurityError"
        }
      }
    },
    "500": {
      "description": "Unexpected server error",
      "content": {
        "application/json": {
          "$ref": "#/components/schemas/ApiError"
        }
      }
    }
  }
}

POST /api/v1/auth/logout 仅限 JWT。通过 Authorization: Bearer <access token> 发送当前 JWT;可选在 JSON 请求体中发送 refreshToken 一并撤销。服务将提供的令牌值加入黑名单后确认登出。

nfy_ 自动化密钥不能调用此接口。响应后应清除本地令牌存储,且不得在客户端诊断中记录任一令牌。缺少或无效的 JWT 认证会被拒绝。

http
POST /api/v1/auth/logout
Authorization: Bearer <access token>