-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WxOpenConfigStorage中怎么控制不自动刷新ComponentAccessToken #1303
Comments
这还真是个问题。@007gzs 有空可以看下呢 |
007gzs
added a commit
to 007gzs/weixin-java-tools
that referenced
this issue
Nov 27, 2019
可以重写 config 中的 autoRefreshToken函数返回false可以不自动刷新 ComponentAccessToken,授权公众号的token原来是直接刷新的,刚提交了个PR,沿用三方的配置 |
binarywang
pushed a commit
that referenced
this issue
Nov 28, 2019
yuanqixun
pushed a commit
to yuanqixun/weixin-java-tools
that referenced
this issue
Nov 30, 2019
…-tools into develop * 'develop' of https://github.com/Wechat-Group/weixin-java-tools: (439 commits) 优化注释 🎨 binarywang#1303 开放平台WxOpenInnerConfigStorage中自动刷新token配置沿用WxOpenConfigStorage中配置 ✨ binarywang#1009 实现微信小程序物流助手相关接口 🎨 优化代码,把签名工具类里面的常量提取出来 binarywang#1297 企业外部联系人客户变更事件新增 ChangeType 常量 📝 更新版本信息 🔖 发布3.6.0正式版本 🎨 binarywang#1294 优化getAccessToken方法,解决并发时重复刷新的问题 🐛 binarywang#1288 企业微信修复创建成员同时回调create_user和update_user事件判断成重复的BUG ✨ binarywang#1287 公众号模块新增下载微信jssdk上传的高清语音素材的接口 🔖 发布3.5.10.B测试版本 🎨 binarywang#1265 企业微信通讯录接口支持设置地址 Update README.md Update README.md 🎨 Optimize images (binarywang#1279) update banners ✨ binarywang#1123 增加设置小程序“扫普通链接二维码打开小程序”能力的五个接口 🐛 binarywang#1276 修复微信开放平台获取授权列表接口token参数导致死循环的问题 ✨ binarywang#1271 企业微信标签创建接口支持传入id参数 🔖 发布3.5.9.B测试版本 ...
已修复 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
WxOpenConfigStorage中怎么控制不自动刷新ComponentAccessToken,现在autoRefreshToken()默认值为true
/*
* 发生以下情况时尝试刷新access_token
* 40001 获取access_token时AppSecret错误,或者access_token无效
* 42001 access_token超时
* 40014 不合法的access_token,请开发者认真比对access_token的有效性(如是否过期),或查看是否正在为恰当的公众号调用接口
*/
if (error.getErrorCode() == 42001 || error.getErrorCode() == 40001 || error.getErrorCode() == 40014) {
// 强制设置wxMpConfigStorage它的access token过期了,这样在下一次请求里就会刷新access token
this.getWxOpenConfigStorage().expireComponentAccessToken();
if (this.getWxOpenConfigStorage().autoRefreshToken()) {
return this.post(uri, postData, accessTokenKey);
}
}
The text was updated successfully, but these errors were encountered: