跳转到内容
开发者文档 / 认证接口

登录

使用邮箱和密码登录,成功后返回用户访问令牌。

POST/api/auth/login

鉴权方式 请求头 Api-Key、Api-Secret

Content-Type application/json

请求体

参数类型必填说明
emailstring是登录邮箱,服务端按小写处理
passwordstring是登录密码
uuidstring否登录验证码会话 UUID
codestring否登录验证码
providerstring绑定第三方账号时授权平台,取值为 QQ、WECHAT、GITHUB、BILIBILI
bindingTicketstring绑定第三方账号时使用同一平台的 /api/auth/third-party/login 在 bound=false 时返回的短期一次性票据

普通密码登录可省略这两个字段。绑定已有会员时,同时提交邮箱、密码、provider 和 bindingTicket。旧版 openId 字段不能替代票据。

bash
curl -X POST 'https://resource-api.xyeidc.com/api/auth/login' \
  -H 'Api-Key: YOUR_API_KEY' \
  -H 'Api-Secret: YOUR_API_SECRET' \
  -H 'Content-Type: application/json' \
  -d '{"email":"developer@example.com","password":"ExamplePass123"}'

响应示例

json
{
  "code": 200,
  "msg": "Success!",
  "data": {
    "memberId": 10001,
    "isAdmin": false,
    "token": "USER_ACCESS_TOKEN",
    "createTime": 1786060800000,
    "expireTime": 1786665600000
  }
}

令牌属于敏感信息,请仅通过 HTTPS 传输并安全保存,不要写入日志或公开仓库。