用户刷新 token 接口

  • 接口说明: 刷新 token 接口
  • 接口地址: /api/refresh-token
  • 请求方式: POST

请求参数

参数名称类型是否必须描述
refresh_tokenstring刷新令牌
grant_typestring固定值:refresh_token
scopearray范围权限列表
client_secretstring客户的秘钥
client_idint客户的 ID

请求示例

  1. {
  2. "data": {
  3. "attributes": {
  4. "grant_type": "refresh_token",
  5. "refresh_token": "def502003840......3c420090c5a7",
  6. "client_id": 2
  7. }
  8. }
  9. }

返回结果

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

返回说明

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

返回示例

  1. // 成功示例
  2. {
  3. "data": {
  4. "type": "token",
  5. "id": "0",
  6. "attributes": {
  7. "token_type": "Bearer",
  8. "expires_in": 86400,
  9. "access_token": "eyJ0eXAiOiJKV1QiLC......BQHUssAOfMLQMiA",
  10. "refresh_token": "def50200ba012c992......fb3db9aff71eb00"
  11. }
  12. }
  13. }
  14. //失败示例
  15. {
  16. "errors": [
  17. {
  18. "status": 401,
  19. "code": "invalid_request",
  20. "detail": {
  21. "error": "invalid_request",
  22. "error_description": "The refresh token is invalid.",
  23. "hint": "Cannot decrypt the refresh token",
  24. "message": "The refresh token is invalid."
  25. }
  26. }
  27. ]
  28. }
  29. //失败示例
  30. {
  31. "error": "invalid_request",
  32. "error_description": "The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed.",
  33. "hint": "Check the `client_id` parameter",
  34. "message": "The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed."
  35. }