跳到正文
MuoCeon 文档中心
v1auth 上下文凭据管理

密码凭据

PUT /v1/auth/credentials/password:首次设置或修改密码。

PUT /v1/auth/credentials/password 同时承担「首次设置密码」和「修改密码」两件事。

请求

参数类型必填说明
current_passwordstring条件必填已有密码时必填,1–128 字符
new_passwordstring✅新密码,8–128 字符
curl -X PUT 'https://id.example.com/v1/auth/credentials/password' \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{"current_password":"old","new_password":"new-strong-pass"}'
{ "success": true, "credential": { "id": "cred_...", "type": "password" } }

是否必填由服务端判定

账号有没有密码是服务端状态,不能让客户端传一个「我没有密码」的标志位来绕过当前密码校验。 因此 current_password 在已有密码时缺失会直接失败,在首次设密码时被忽略。

要求

  • 提权:max_age=300;
  • 密码强度有硬性下限,弱密码会被拒绝而不是「提示但允许」;
  • 成功写入安全记录,记为 password.change。

相关

本页目录