Skip to content

获取 token 接口 ​

接口说明

获取 token

请求参数

请求服务:智数通服务地址 http 端口

请求方式:GET

请求路径:/oauth2/token

请求示例

说明:http://zhishutong.dev.idx.space/auth为1中返回的oauthUrl

http://zhishutong.dev.idx.space/auth/oauth2/token?grant\_type=authorization\_code&client\_id=7a6e7bcd7fa14c8d8e8fc9d1ddc9c81f&client\_secret=58e76bcf2baf4fbe82c00308b4cb0f36&code=BCRJxUP9xu9SBx5ovhiimj6onaS3huKm1FZLkkefmM8UjF0HTARxHv03dF9o

参数是否必填说明
grant_type是授权类型,填写:authorization_code(固定写死)
client_id是应用 id(客户端向服务端申请)
client_secret是应用秘钥(客户端向服务端申请)
code是1 中获取到的授权码

响应参数

参数类型最大长度备注示例
codeInt-状态码200
msgString-状态码描述ok
dataObject-返回数据
data.access_tokenString-tokenxxx
data.refresh_tokenString-刷线 tokenxxx
data.expires_inInt-token 过期时间(单位:秒)1799
data.refresh_expires_inInt-刷新 token 过期时间(单位:秒)2591999
data.client_idString-应用 id
data.scopeString-此令牌包含的权限userinfo
data.openidString--null

响应示例

xml
{
   "code": 200,
   "msg": "ok",
   "data": {
      "access_token": "0DCoL8OuELw8xJ2zVrVBibXAvGhhJtWIfitoGkun1UZZnGjI3JGyqjbqtD1Z",
      "refresh_token": "pICFPHKSsvFP7ZVQKSw9UtHvN0EajndbE5p9q5Qs6dKUru80zEFsrMMyystk",
      "expires_in": 7199,
      "refresh_expires_in": 2591999,
      "client_id": "1001",
      "scope": "userinfo",
      "openid": null
   }
}
{
   "code": 200,
   "msg": "ok",
   "data": {
      "access_token": "0DCoL8OuELw8xJ2zVrVBibXAvGhhJtWIfitoGkun1UZZnGjI3JGyqjbqtD1Z",
      "refresh_token": "pICFPHKSsvFP7ZVQKSw9UtHvN0EajndbE5p9q5Qs6dKUru80zEFsrMMyystk",
      "expires_in": 7199,
      "refresh_expires_in": 2591999,
      "client_id": "1001",
      "scope": "userinfo",
      "openid": null
   }
}

Released under the MIT License.