您好,开发者ID(AppID) wx8fb529413f1b0e26 的公众号,在重置AppSecret后调用报40125的问题,在重置之前接口调用一直是正常的;由于安全原因,只是重置了一次AppSecret并且我们的业务平台也相应的调用了新的AppSecret,但是后台日志跟踪打印提示 errcode:40125 errmsg:invalid appsecret,view more at http://t.cn/
请求地址
String requestUrl = “https://api.weixin.qq.com/sns/oauth2/access_token?appid=APPID&secret=SECRET&code=CODE&grant_type=authorization_code”;
requestUrl = requestUrl.replace(“APPID”, appId);
requestUrl = requestUrl.replace(“SECRET”, appSecret);
requestUrl = requestUrl.replace(“CODE”, code);
获取授权凭证
JSONObject jsonObject = WeixinUtil.httpRequest(requestUrl, “GET”, null);
if (null != jsonObject) {
try {
wat = new WeixinOauth2Token();
wat.setAccessToken(jsonObject.getString(“access_token”));
wat.setExpiresIn(jsonObject.getInt(“expires_in”));
wat.setRefreshToken(jsonObject.getString(“refresh_token”));
wat.setOpenId(jsonObject.getString(“openid”));
wat.setScope(jsonObject.getString(“scope”));
} catch (Exception e) {
wat = null;
int errorCode = jsonObject.getInt(“errcode”);
String errorMsg = jsonObject.getString(“errmsg”);
log.error(“获取授权凭证失败 errcode:{} errmsg:{}”, errorCode, errorMsg);
}
}