POST/api/v1/admin/users/:userId/reset-credentials重置用户凭据
Try it 面板需要启用 JavaScript。
管理侧重置:密码清空、指定 MFA 因素解绑或 OTP 状态复位;重置后吊销全部会话。
Request
Headers
| Name | Data Type | Required | Description |
|---|---|---|---|
| Authorization | string | Yes | 会话令牌认证,格式 `Bearer <sessionToken>` |
| Content-Type | string | Yes | 请求体内容类型(默认值 "application/json") |
type RequestHeaders = {
/** 会话令牌认证,格式 `Bearer <sessionToken>` */
Authorization: string
/** 请求体内容类型,默认值 "application/json" */
Content-Type: string
}{
"Authorization": "Bearer st_7c1f9e05b28d4a63",
"Content-Type": "application/json"
}URL Parameters
| Name | Data Type | Description |
|---|---|---|
| userId | string | 用户 ID |
Body
| Name | Data Type | Required | Description |
|---|---|---|---|
| type | string | Yes | 重置目标:password(清空密码)/ mfa(解绑全部 MFA 因素)/ otp(复位 OTP 频控与作废码) |
type RequestBody = {
/** 重置目标:password(清空密码)/ mfa(解绑全部 MFA 因素)/ otp(复位 OTP 频控与作废码) */
type: string
}{
"type": "mfa"
}Response
Body
result type: null
HTTP Code
| HTTP Status | Meaning | Notes |
|---|---|---|
| 200 | 成功 | 凭据已重置 |
| 409 | 凭据不存在 | 该类型凭据未设置 |
Response Code
响应使用统一信封 {id, code, messages, result},其 code 字段:
| code | Meaning | Notes |
|---|---|---|
| 0 | 成功 | 凭据已重置,全部会话吊销 |
| 2903 | 凭据不存在 | 该类型凭据未设置(如未设密码时重置 password) |
Examples
POST /api/v1/admin/users/01JD8SEGQ0P9N2XK4L7VDH3T6C/reset-credentials
Authorization: Bearer st_7c1f9e05b28d4a63
Content-Type: application/json
{
"type": "mfa"
}
{
"id": "01JD8ST3TY8T1VK",
"code": 0,
"messages": [],
"result": null
}
Remarks
清空密码后用户凭 OTP 或三方登录,并在登录后重新设置密码;重置动作本身写入审计日志。