二、用户登录接口

最后更新于:2022-05-28 14:13:11

  • 接口说明: 用户登录接口
  • 接口地址: /api/uc/login
  • 请求方式: POST

#请求参数

参数名称类型是否须描述
usernamevarchar用户名
passwordvarchar密码
questionidvarchar问题
answervarchar答案

#请求示例

{
  "data": {
    "attributes": {
      "username": "username",
      "password": "password",
      "questionid": "",
      "answer": ""
    }
  }
}

返回结果

参数名称类型出现要求描述
token_typestring登录成功token 类型
expires_inint登录成功时间
access_tokentoken登录成功用户标识
refresh_tokentoken登录成功刷新用户标识

#返回说明

  • 登录成功, http 状态码: 200
  • 登录失败, http 状态码: 500

#返回示例

{
  "data": {
    "type": "token",
    "id": "1",
    "attributes": {
      "token_type": "Bearer",
      "expires_in": 2592000,
      "access_token": "eyJ0eXAiOiJKV1Qi......dj3H9CCSPib6MQtnaT6VNrw",
      "refresh_token": "def50200a26b6a9......10ccbf3c1694084c2d2d276"
    }
  }
}

#返回失败

{
  "error": "invalid_grant",
  "error_description": "The provided authorization grant (e.g., authorization code, resource owner credentials) or refresh token is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client.",
  "hint": "",
  "message": "The provided authorization grant (e.g., authorization code, resource owner credentials) or refresh token is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client."
}