API地址

正式环境 https://cvd.xiaoduoai.com
测试环境 https://cvd-test.xiaoduoai.com


接口列表  

1、获取code
2、获取access_token
3、刷新access_token
4、获取用户信息


获取code

请求

接口地址 : /oauth_authorize

请求方式 :POST/GET FORM

登录请求参数:

参数 类型 描述
client_id int 分配给平台的ID
response_type string 值固定为code
scope string 固定为userinfo
redirect_uri string code回调地址,不能带参数
state string 这个值,授权成功是后原样回调给redirect_uri

示例: https://cvd-test.xiaoduoai.com/passport/oauth_authorize?client_id=100&response_type=code&redirect_uri=http://xxxx.com/call_back&state=123

假如授权成功跳转到: http://xxxx.com/call_back?code=ae5a4545ad766fsjdu2722&state=123

第三方获取到code后,取access_token,详情见后续接口描述。


获取access_token

请求

接口地址 : /v1/auth/oauth_get_access_token

请求方式 :POST/GET FORM

登录请求参数:

参数 类型 描述
grant_type string 固定code
client_id int 分配给平台的ID
code string 前面接口生成的验证码
redirect_uri string 请求code接口所用的跳转地址
返回
{
    "error_code":0,  
    "info":"ok",  
    "access_token":"", // 授权token, 用于请求用户信息
    "expires_in":3600, // access_token 多长时间过期
    "refresh_token":"", // 用于刷新 access_token
    "refresh_expires_in":2592000  // 30天过期   
}  

刷新access_token

请求

接口地址 : /v1/auth/oauth_refresh_token

请求方式 :POST/GET FORM

登录请求参数:

参数 类型 描述
grant_type string 固定code
client_id int 分配给平台的ID
refresh_token string
返回
{
    "error_code":0,  
    "info":"ok",  
    "access_token":"", // 授权token, 用于请求用户信息
    "expires_in":3600, // access_token 多长时间过期
    "refresh_expires_in":592000  // 还有多长时间过期   
}  

获取用户信息

请求

接口地址 : /v1/auth/oauth_get_userinfo

请求方式 :POST/GET FORM

登录请求参数:

参数 类型 描述
sign string MD5签名 MD5(access_token=$access_token&ts=$ts&secret=$secret)
ts int 当前unix时间戳(秒)
access_token string
返回
{
    "error_code":0,  
    "info":"ok",  
    "id":123, //用户ID
    "unit_id":21, // 企业ID
    "type":1,  // 用户类型   1 超级管理员  2 管理员  3 主管  4 客服   
    "nick":"", //昵称
    "face_url": "" //头像
}  

results matching ""

    No results matching ""