Skip to content

POST /api/v1/auth/2fa/recovery-codes

POST/api/v1/auth/2fa/recovery-codes

重新生成恢复码(需当前 TOTP 验证码,旧恢复码作废)

useroperationId: mfaRegenerateRecovery

请求体

请求数据

Content-Type · application/json

{
  "type": "object",
  "required": [
    "code"
  ],
  "properties": {
    "code": {
      "type": "string"
    }
  }
}

请求示例

cURL
curl -X POST 'http://localhost:8080/api/v1/auth/2fa/recovery-codes' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer <JWT>'
JavaScript
const res = await fetch('http://localhost:8080/api/v1/auth/2fa/recovery-codes', {
  method: 'POST',
  headers: {
    'Accept': 'application/json',
    'Authorization': 'Bearer <JWT>'
  },
});
const data = await res.json();
Python
import requests

res = requests.post(
    'http://localhost:8080/api/v1/auth/2fa/recovery-codes',
    headers={'Accept': 'application/json', 'Authorization': 'Bearer <JWT>'}
)
print(res.json())

响应

200成功

application/json

{
  "type": "object",
  "description": "通用响应包装",
  "properties": {
    "code": {
      "type": "string",
      "example": "ok"
    },
    "message": {
      "type": "string",
      "example": "ok"
    },
    "data": {}
  }
}

在线调试

在线调试
凭证仅保存在当前页面内存中
自定义请求 Header