获取accesstoken时报错,利用PostMethod访问 时
public static String getAccessToken(String appid, String appsecret) throws Exception{
String accessToken = null;
// PostMethod get = new PostMethod(access_token_url);
GetMethod get = new GetMethod(access_token_url);
// post.setRequestHeader("Referer", access_token_url);
// post.setRequestHeader(USER_AGENT_H, USER_AGENT);
int status = client.executeMethod(get);
if (status == HttpStatus.SC_OK) {
String msg = get.getResponseBodyAsString();
System.out.println(msg);
AccessToken at = JSON.parseObject(msg, AccessToken.class);
// Weixin.msgSendCode = ret.getExpiresIn();
accessToken = at.getToken();
System.out.println(accessToken );
}
报错:{"errcode":41004,"errmsg":"appsecret missing"}
阅读全文
收起全文