# 通过wxcode
换取access_token
# 接口说明
host | path | method | content-type |
---|---|---|---|
open.wecard.qq.com | connect/oauth2/token | POST | application/json |
# 请求参数
移动端或者 pc 端获取的授权wxcode
{
"wxcode": "WXCODE",
"app_key": "APP_KEY",
"app_secret": "APP_SECRET",
"grant_type": "authorization_code",
"redirect_uri": "https://example.com"
}
小程序插件获取的授权wxcode
{
"wxcode": "WXCODE",
"app_key": "APP_KEY",
"app_secret": "APP_SECRET",
"grant_type": "authorization_code",
"redirect_uri": "mnp://xxxxxxxxxxxx"
}
参数 | 必填 | 类型 | 说明 |
---|---|---|---|
wxcode | ✔️ | string | 获取成员信息授权码(有效期 5 分钟) |
app_key | ✔️ | string | 腾讯微卡分配的应用 appkey |
app_secret | ✔️ | string | 腾讯微卡分配的应用 appsecret |
grant_type | ✔️ | string | 返回类型(固定填 authorization_code) |
redirect_uri | ✔️ | string | 回调地址(需与请求授权时的地址保持一致/小程序为 mnp:// + 小程序app id ) |
# 响应参数
{
"refresh_token": "xxxxxxxx",
"access_token": "xxxx",
"token_type": "bearer",
"expires_in": 7200,
"ocode": "xxxxxx"
}
# data 中的参数说明
参数 | 类型 | 说明 |
---|---|---|
refresh_token | string | 用来刷新 access_token |
access_token | string | 应用获取授权信息有效凭证 |
token_type | string | token 类型,固定为 bearer |
expires_in | int | 有效凭证的有效期 |
ocode | string | 主体代码 |