# 接口调用凭证
该授权方式使用 OAuth2 的 client credentials 模式,获取小程序全局唯一后台接口调用凭据。
说明:access_token48小时内有效,未超出有效截止时间,开发者重新调用获取新的access_token,则新老token同时有效。避免token过期,开发者可根据业务实际情况,注意间隔请求时间,不要超出48小时。
# 请求地址
POST https://open.kuaishou.com/oauth2/access_token
content-type: x-www-form-urlencoded
# 参数
属性 | 类型 | 必填 | 说明 |
---|---|---|---|
app_id | string | 是 | 小程序的 app_id |
app_secret | string | 是 | 小程序的密钥 |
grant_type | string | 是 | 固定值“client_credentials” |
# 返回值
{
"result": 1,
"access_token": "xxxxxxx", // 用于获取隐私资源
"expires_in": 23435, // 过期时间(秒)
"token_type" : "bearer"
}
# 错误码
当 result 不为 1 时,说明请求错误。错误码如下
错误码 | 含义 |
---|---|
100200100 | 参数有误,需要检查参数是否为空或有误 |
100200101 | 验证出错,需要检查app_id和app_secret |