NATSotp.mfa.verify校验 MFA 码
Try it 面板需要启用 JavaScript。
登录中或绑定确认时校验 TOTP 码;登录场景由调用方先经 attempt_service 记录通过后计入 MFA 因素分。
Request Payload
消息格式:JSON
| Name | Data Type | Required | Description |
|---|---|---|---|
| userId | string | Yes | 用户 ID |
| code | string | Yes | TOTP 码(6 位) |
| confirmingFactorId | string | No | 绑定确认场景:待确认因素 ID |
type RequestBody = {
/** 用户 ID */
userId: string
/** TOTP 码(6 位) */
code: string
/** 绑定确认场景:待确认因素 ID */
confirmingFactorId?: string
}{
"userId": "01JD8SEGQ0P9N2XK4L7VDH3T6C",
"code": "384127"
}Response Payload
回复使用统一信封 {id, code, messages, result},其 result:
| Name | Data Type | Required | Description |
|---|---|---|---|
| verified | boolean | Yes | 是否通过 |
| factorId | string | Yes | 通过的因素;绑定确认场景为转 active 的因素 ID |
| status | string | No | 绑定确认场景返回 active |
type ResponseBody = {
/** 是否通过 */
verified: boolean
/** 通过的因素;绑定确认场景为转 active 的因素 ID */
factorId: string
/** 绑定确认场景返回 active */
status?: string
}{
"verified": true,
"factorId": "01JD8SKH5N6P9W5XP9T4WDJ7U0C",
"status": "active"
}Response Code
回复使用统一信封 {id, code, messages, result},其 code 字段:
| code | Meaning | Notes |
|---|---|---|
| 0 | 成功 | 校验 MFA 码 |
| 2204 | MFA 码错误 | |
| 2202 | 因素不存在 | 对应用户无该因素 |
Examples
{ "userId": "01JD8SEGQ0P9N2XK4L7VDH3T6C", "code": "384127" }
{
"id": "01JD8SVHL3W9Y6ZV",
"code": 0,
"messages": [],
"result": { "verified": true, "factorId": "01JD8SKH5N6P9W5XP9T4WDJ7U0C", "status": "active" }
}
Remarks
携带 confirmingFactorId 时通过即激活因素;不携带则为登录校验。