issue #104 WxCpService.oauth2getUserInfo方法不会去刷新access token

This commit is contained in:
Daniel Qian 2015-02-09 09:07:54 +08:00
parent d2eb529ab2
commit 1e94c452ba

View File

@ -427,22 +427,13 @@ public class WxCpServiceImpl implements WxCpService {
@Override
public String[] oauth2getUserInfo(String code) throws WxErrorException {
String url = "https://qyapi.weixin.qq.com/cgi-bin/user/getuserinfo?";
url += "access_token=" + wxCpConfigStorage.getAccessToken();
url += "&code=" + code;
url += "&agendid=" + wxCpConfigStorage.getAgentId();
try {
RequestExecutor<String, String> executor = new SimpleGetRequestExecutor();
String responseText = executor.execute(getHttpclient(), httpProxy, url, null);
JsonElement je = Streams.parse(new JsonReader(new StringReader(responseText)));
JsonObject jo = je.getAsJsonObject();
return new String[] {GsonHelper.getString(jo, "UserId"), GsonHelper.getString(jo, "DeviceId")};
} catch (ClientProtocolException e) {
throw new RuntimeException(e);
} catch (IOException e) {
throw new RuntimeException(e);
}
String url = "https://qyapi.weixin.qq.com/cgi-bin/user/getuserinfo?"
+ "code=" + code
+ "&agendid=" + wxCpConfigStorage.getAgentId();
String responseText = get(url, null);
JsonElement je = Streams.parse(new JsonReader(new StringReader(responseText)));
JsonObject jo = je.getAsJsonObject();
return new String[] {GsonHelper.getString(jo, "UserId"), GsonHelper.getString(jo, "DeviceId")};
}
@Override