收藏
回答

msgSecCheck 在java后台返回41001,token有值?

package api;


import java.util.HashMap;

import java.util.Map;


import com.google.gson.JsonObject;

import com.google.gson.JsonParser;


import globle.UitlHttp;

import globle.Utilwx;


public class wxsscheck {

static wxsscheck s_wxsscheck;


public static wxsscheck getInstance() {

if (s_wxsscheck == null) {

s_wxsscheck = new wxsscheck();


}

return s_wxsscheck;

}


String mtookenString = "";

long mtime = 0;


String check(String contextv) {

String url = "https://api.weixin.qq.com/wxa/msg_sec_check";

Map<String, String> objmap = new HashMap<String, String>();

objmap.put("content", contextv);

objmap.put("access_token", mtookenString);

String reString = UitlHttp.dopost(url, "", objmap);

return reString;


}


public String Checktxt(String contextv) {

if (System.currentTimeMillis() - mtime < 120 * 60 * 1000 && mtookenString.length() > 10) {


return check(contextv);


}

mtime = System.currentTimeMillis();

String url = "https://api.weixin.qq.com/cgi-bin/token";


Map<String, String> objmap = new HashMap<String, String>();

objmap.put("appid", Utilwx.appid); 

objmap.put("secret", Utilwx.secret); 

objmap.put("grant_type", "client_credential");

String access_token = UitlHttp.doGet(url, objmap);

if (access_token == null || access_token.length() < 1) {

return "no";

} else if (access_token.contains("errcode")) {

return "no";

}

JsonObject json = new JsonParser().parse(access_token).getAsJsonObject();

mtookenString = json.get("access_token").getAsString();

return check(contextv);


}

}

--------

返回 {"errcode":41001,"errmsg":"access_token missing hint: [7qxEjA02498671!]"}

access_token,为什么返回41001

求解

最后一次编辑于  11-26
回答关注问题邀请回答
收藏

2 个回答

  • o0o有脾气的酸奶
    o0o有脾气的酸奶
    11-26


    11-26
    赞同
    回复
  • 郑栋🤔
    郑栋🤔
    11-26

    {"errcode":41001,"errmsg":"access_token missing hint: [an2U808052281!]"}

    access_token的值是:  27_vIsHtI0Ii1Io02WbjmHKqgldFTyE-c8ZBayZ-cGmn2p9WvU9otJkXRjWCDOCliHXzgIyITM2Vloj79ptQbrl8SFZIC-EHL_08E0mvLimZJg6I-2fYVXWwpCb9DYDGHgAIASVW

    11-26
    赞同
    回复
问题标签