用户登录接口

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

请求参数

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

请求示例

  1. {
  2. "data": {
  3. "attributes": {
  4. "username": "username",
  5. "password": "password",
  6. "questionid": "",
  7. "answer": ""
  8. }
  9. }
  10. }

返回结果

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

返回说明

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

返回示例

  1. {
  2. "data": {
  3. "type": "token",
  4. "id": "1",
  5. "attributes": {
  6. "token_type": "Bearer",
  7. "expires_in": 2592000,
  8. "access_token": "eyJ0eXAiOiJKV1Qi......dj3H9CCSPib6MQtnaT6VNrw",
  9. "refresh_token": "def50200a26b6a9......10ccbf3c1694084c2d2d276"
  10. }
  11. }
  12. }

失败示例

  1. {
  2. "error": "invalid_grant",
  3. "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.",
  4. "hint": "",
  5. "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."
  6. }