GET/api/v1/auth/attempt查看登录尝试状态

以尝试工单换取当前分数、阈值与可选因素,供前端决定下一步展示;查看不消费工单。

Request

Query Parameters

NameData TypeRequiredDescription
ticketstringYes尝试工单
type QueryParams = {
  /** 尝试工单 */
  ticket: string
}
{
  "ticket": "atk_9f2c7be14d0a53e8"
}

Response

Body

NameData TypeRequiredDescription
attemptTicketstringYes尝试工单(不透明,后续因素继续携带)
statusstringYespending 未达标 / satisfied 已达标
scorenumberYes当前累加分数
thresholdnumberYes签发会话所需阈值
verifiedFactorsarrayYes已通过的因素(password / otp / mfa / captcha)
nextFactorsarrayYes按配置仍可选的下一因素
expiresAtstringYes尝试与工单的过期时间
type AttemptStateDTO = {
  /** 尝试工单(不透明,后续因素继续携带) */
  attemptTicket: string
  /** pending 未达标 / satisfied 已达标 */
  status: string
  /** 当前累加分数 */
  score: number
  /** 签发会话所需阈值 */
  threshold: number
  /** 已通过的因素(password / otp / mfa / captcha) */
  verifiedFactors: string[]
  /** 按配置仍可选的下一因素 */
  nextFactors: string[]
  /** 尝试与工单的过期时间 */
  expiresAt: string
}
{
  "attemptTicket": "atk_9f2c7be14d0a53e8",
  "status": "pending",
  "score": 40,
  "threshold": 60,
  "verifiedFactors": [
    "password"
  ],
  "nextFactors": [
    "otp",
    "mfa",
    "captcha"
  ],
  "expiresAt": "2026-10-14T08:10:00Z"
}

HTTP Code

HTTP Status Meaning Notes
200 成功 返回尝试状态
400 工单无效 工单不存在或已过期

Response Code

响应使用统一信封 {id, code, messages, result},其 code 字段:

code Meaning Notes
0 成功 返回尝试状态
2007 尝试工单无效 工单不存在、过期或已消费

Examples

GET /api/v1/auth/attempt?ticket=atk_9f2c7be14d0a53e8
{
  "id": "01JD8SH6T1N8M2Y1",
  "code": 0,
  "messages": [],
  "result": {
    "attemptTicket": "atk_9f2c7be14d0a53e8",
    "status": "pending",
    "score": 40,
    "threshold": 60,
    "verifiedFactors": ["password"],
    "nextFactors": ["otp", "mfa", "captcha"],
    "expiresAt": "2026-10-14T08:10:00Z"
  }
}