https://api.weixin.qq.com/cgi-bin/user/info报40001?
刚刚刷新access_token,但请求https://api.weixin.qq.com/cgi-bin/user/info报40001。其中: ----------获取access_token接口方法-----------------------------------------------------------
public final static String ACCESS_TOKEN_URL = "https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=CORPID&corpsecret=CORPSECRET";
public static JSONObject getAccessTokenInfo(String appid, String appsecret, String wechattype) {
String requestUrl = "";
JSONObject accesstokenJson = new JSONObject();
//企业号
requestUrl = WeiXinUtil.ACCESS_TOKEN_URL;
requestUrl = requestUrl.replace("CORPID", appid).replace("CORPSECRET", appsecret);
accesstokenJson = HttpUtil.httpRequestwx(requestUrl, "GET", null);
return accesstokenJson;
}
-----------转unionid方法-------------------------------------------------------------------------
public static void main(String[] args) {
String token = "token";
String userinfostr = HttpUtil.sendGet("https://api.weixin.qq.com/cgi-bin/user/info", "access_token="+token+"&openid="+"openid"+"&lang=zh_CN", "UTF-8");
JSONObject userinfo = JSONObject.parseObject(userinfostr);
System.out.println(userinfo);
}
----------------返回-----------------------------------
errcode -> {Integer@1525} 40001
errmsg -> invalid credential, access_token is invalid or not latest, could get access_token by getStableAccessToken, more details at https://mmbizurl.cn/s/JtxxFh33r rid: 65f01511-144c0b9c-005c25a6