授权接口列表 (申请token)

需要授权

应用申请使用oauth2协议授权第二步:根据授权码获取accessToken和refreshToken

请求参数:

签名:

签名信息 签名类型
是否签名

POST请求地址:

环境 https请求地址
正式环境 https://openauth.duolabao.com/oauth/token

公共请求参数:

参数名称 参数类型 是否必填 最大长度 参数说明 示例值
appNum String 32 客户端id,第三方AppNum 11103984930302
appSecretKey String 32 客户端密钥 0f683c01b9374f17979ea896712386299b2ee3f0
grantType String 32 授权类型,必填,固定值authorization_code即可 authorization_code
code String 32 申请授权之后收到的授权码 zLl170
redirectUrl String 32 重定向uri https://yourdomain.com/callback

请求示例:

  • 请求示例
  • 请求示例
  • 1 https://openauth.duolabao.com/oauth/token?appNum={appNum}&appSecretKey={appSecretKey}&
    2 grantType=authorization_code&code={code}&redirectUrl={redirectUrl}
  • 1 https://openauth.duolabao.com/oauth/token?appNum=11103984930302&appSecretKey=q3edsf2dddds&
    2 grantType=authorization_code&code=zLl170&redirectUrl=https://yourdomain.com/callback?
    3 code=zLl170

返回参数JSON格式:

参数名称 参数类型 是否必填 最大长度 参数说明 示例值
accessToken String 32 token 45445678-0716-4825-adc8-324c33436ed8
tokenType String 32 Token类型 bearer
refreshToken String 32 刷新token fff2a685-ecde-4bee-b405-a13899a8b8e5
expiresIn String 32 Token有效期 2692
scope String 32 范围 read
customerOpenId String 32 商戶openid 123412313

响应示例:

  • 响应示例
  • 1 {
    2 "accessToken": "45445678-0716-4825-adc8-324c33436ed8",
    3 "tokenType": "bearer",
    4 "refreshToken": "fff2a685-ecde-4bee-b405-a13899a8b8e5",
    5 "expiresIn": 2692,
    6 "scope": "read",
    7 "customerOpenId":"123412313"
    8 }