浏览代码

#568 修复三方平台多次授权时,RefreshToken 没有刷新的问题

* fix 多次授权时,RefreshToken 没有刷新

* null 判断
master
007gzs 7 年前
committed by Binary Wang
父节点
当前提交
9ff53a59f9
共有 1 个文件被更改,包括 13 次插入9 次删除
  1. +13
    -9
      weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenComponentServiceImpl.java

+ 13
- 9
weixin-java-open/src/main/java/me/chanjar/weixin/open/api/impl/WxOpenComponentServiceImpl.java 查看文件

@@ -193,14 +193,6 @@ public class WxOpenComponentServiceImpl implements WxOpenComponentService {
if (queryAuth == null || queryAuth.getAuthorizationInfo() == null || queryAuth.getAuthorizationInfo().getAuthorizerAppid() == null) {
throw new NullPointerException("getQueryAuth");
}
WxOpenAuthorizationInfo authorizationInfo = queryAuth.getAuthorizationInfo();
if (authorizationInfo.getAuthorizerAccessToken() != null) {
getWxOpenConfigStorage().updateAuthorizerAccessToken(authorizationInfo.getAuthorizerAppid(),
authorizationInfo.getAuthorizerAccessToken(), authorizationInfo.getExpiresIn());
}
if (authorizationInfo.getAuthorizerRefreshToken() != null) {
getWxOpenConfigStorage().setAuthorizerRefreshToken(authorizationInfo.getAuthorizerAppid(), authorizationInfo.getAuthorizerRefreshToken());
}
return "success";
}
return "";
@@ -212,7 +204,19 @@ public class WxOpenComponentServiceImpl implements WxOpenComponentService {
jsonObject.addProperty("component_appid", getWxOpenConfigStorage().getComponentAppId());
jsonObject.addProperty("authorization_code", authorizationCode);
String responseContent = post(API_QUERY_AUTH_URL, jsonObject.toString());
return WxOpenGsonBuilder.create().fromJson(responseContent, WxOpenQueryAuthResult.class);
WxOpenQueryAuthResult queryAuth = WxOpenGsonBuilder.create().fromJson(responseContent, WxOpenQueryAuthResult.class);
if (queryAuth == null || queryAuth.getAuthorizationInfo() == null) {
return queryAuth;
}
WxOpenAuthorizationInfo authorizationInfo = queryAuth.getAuthorizationInfo();
if (authorizationInfo.getAuthorizerAccessToken() != null) {
getWxOpenConfigStorage().updateAuthorizerAccessToken(authorizationInfo.getAuthorizerAppid(),
authorizationInfo.getAuthorizerAccessToken(), authorizationInfo.getExpiresIn());
}
if (authorizationInfo.getAuthorizerRefreshToken() != null) {
getWxOpenConfigStorage().setAuthorizerRefreshToken(authorizationInfo.getAuthorizerAppid(), authorizationInfo.getAuthorizerRefreshToken());
}
return queryAuth;
}

@Override


正在加载...
取消
保存