mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-04-05 17:38:05 +08:00
#568 修复三方平台多次授权时,RefreshToken 没有刷新的问题
* fix 多次授权时,RefreshToken 没有刷新 * null 判断
This commit is contained in:
parent
04ec788d07
commit
9ff53a59f9
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user