Skip to content

登录与 Token

认证控制器是 AuthController,前缀 /auth

登录

POST /auth/login

LoginRequest 里能核对的字段:

字段说明
username / password账密
authType默认 password;还有 password_captchaphone_captchaemail_captchaoauth2social
code / codeKey验证码及缓存 key,不是 uuid
tenantId可选
userClientpc / app / h5 / wechat
phone / email / authCode / socialTicketauthType 使用

成功:RespInfo<LoginResult>LoginResult 字段是 accessTokentokenTypeexpiresInuserInfoforcePasswordChange

json
{
  "code": 200,
  "message": "操作成功",
  "data": {
    "accessToken": "..."
  },
  "timestamp": 1710000000000
}

其它认证接口

方法路径
POST/auth/logout
POST/auth/refreshToken
GET/auth/userInfo
GET/auth/captcha
GET/auth/loginConfig
GET/auth/current/permissions

没有独立的 POST /logoutPOST /refreshToken(缺 /auth 前缀)。

后续请求怎么带头,以当前 sa-token 配置为准。Admin 活动 YAML 里只看到 sa-token.alone-redis.*不要把「默认 30 天」写成已核对的生产值

相关文档