Skip to content
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

关注服务号会报"errcode":61023,"errmsg":"refresh_token is invalid hint: #1119

Closed
gclsoft opened this issue Jul 17, 2019 · 13 comments
Closed

Comments

@gclsoft
Copy link

gclsoft commented Jul 17, 2019

redis服务器重启导致redis数据丢了, 现在关注服务号会报【错误信息】:{"errcode":61023,"errmsg":"refresh_token is invalid hint
要怎么解决呢?

@gclsoft
Copy link
Author

gclsoft commented Jul 17, 2019

wxjava 第三方平台版本: 3.0.0

@gclsoft
Copy link
Author

gclsoft commented Jul 17, 2019

难道必须重新绑定第三方平台才可以解决问题吗? 我们有二十几个服务号,都要这样操作一遍吗?

@gclsoft
Copy link
Author

gclsoft commented Jul 17, 2019

急, 在线等

@gclsoft
Copy link
Author

gclsoft commented Jul 17, 2019

    public String getAuthorizerAccessToken(String appId, boolean forceRefresh) throws WxErrorException {
        if (this.getWxOpenConfigStorage().isAuthorizerAccessTokenExpired(appId) || forceRefresh) {
            JsonObject jsonObject = new JsonObject();
            jsonObject.addProperty("component_appid", this.getWxOpenConfigStorage().getComponentAppId());
            jsonObject.addProperty("authorizer_appid", appId);
            jsonObject.addProperty("authorizer_refresh_token", this.getWxOpenConfigStorage().getAuthorizerRefreshToken(appId));

在这一行获取的时候,就是null了, 因为wechat_authorizer_refresh_token:wx8d297785819f414c已经被丢失了, 要怎么再重新获取呢?

@gclsoft
Copy link
Author

gclsoft commented Jul 17, 2019

    @GetMapping("auth/jump")
    @ResponseBody
    public WxOpenQueryAuthResult jump(@RequestParam("auth_code") String authorizationCode){
        try {
            WxOpenQueryAuthResult queryAuthResult = wxOpenServiceDemo.getWxOpenComponentService().getQueryAuth(authorizationCode);
            logger.info("getQueryAuth", queryAuthResult);
            // 这里要进行缓存才行的吧
            String AppId = queryAuthResult.getAuthorizationInfo().getAuthorizerAppid();
            String reFreshToken = queryAuthResult.getAuthorizationInfo().getAuthorizerRefreshToken();
            wxOpenServiceDemo.getWxOpenConfigStorage().setAuthorizerRefreshToken(AppId, reFreshToken);

只有这个地方设置redis, 真的得全部重新绑定了?

@binarywang
Copy link
Owner

@007gzs 有空可以帮忙看下

@binarywang
Copy link
Owner

另外,楼主请仔细重新描述下你的问题,看起来很乱,现在

@gclsoft
Copy link
Author

gclsoft commented Jul 18, 2019 via email

@007gzs
Copy link

007gzs commented Jul 18, 2019

之前做的时候我记得微信文档里写的只有在授权时推送 refresh_token,丢失的话只能重新授权。
不过刚去看了下好像新增了个 api_get_authorizer_list 接口可以获取所有授权的appid及对应的refresh_token

@gclsoft
Copy link
Author

gclsoft commented Jul 18, 2019 via email

@007gzs
Copy link

007gzs commented Jul 18, 2019

dev貌似有人把接口加进来了,只不过没写到redis里

@gclsoft
Copy link
Author

gclsoft commented Jul 18, 2019

谢谢, 以后遇到同样问题了, 怎么调用这个public WxOpenAuthorizerListResult getAuthorizerList(int begin, int len)?
直接调用 getAuthorizerList(0,100);就可以是吧?

@binarywang
Copy link
Owner

3.4.8.B测试版本已修复相关代码,欢迎试用,如有新问题,请新开issue,谢谢各位

@binarywang binarywang changed the title redis服务器重启导致redis数据丢了, 现在关注服务号会报【错误信息】:{"errcode":61023,"errmsg":"refresh_token is invalid hint: 关注服务号会报"errcode":61023,"errmsg":"refresh_token is invalid hint: Jul 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants