配置双重认证 (2FA)
基于 TOTP (Time-Based One-Time Passwords) RFC 6238 标准
获取启用状态
GET/user/twoFactorAuth/status
请求
无参数
初始化配置
POST/user/twoFactorAuth/setup
请求
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
issuer | string | 否 | 服务名称,默认为 Arcadia |
响应
| 名称 | 类型 | 描述 |
|---|---|---|
secret | string | TOTP 密钥(Base32 编码) |
otpauthUrl | string | otpauth URI(用于生成二维码) |
issuer | string | 服务名称 |
message | string | 提示信息 |
示例
{
"secret": "JBSWY3DPEHPK3PXP",
"otpauthUrl": "otpauth://totp/Arcadia:useradmin?secret=JBSWY3DPEHPK3PXP&issuer=Arcadia&algorithm=SHA1&digits=6&period=30",
"issuer": "Arcadia",
"message": "请使用 Google Authenticator 或 Microsoft Authenticator 扫描二维码"
}
启用
POST/user/twoFactorAuth/enable
请求
| 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|
secret | string | 是 | TOTP 密钥(从 setup 接口获取) |
code | string | 是 | 6 位动态验证码(纯数字) |
需要验证传参
验证通过才会启用
关闭
POST/user/twoFactorAuth/disable
请求
无参数