收藏
回答

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

求解

回答关注问题邀请回答
收藏

3 个回答

  • 梦幻雪冰
    梦幻雪冰
    2020-01-19

    post请求地址需要携带access_token的值,https://api.weixin.qq.com/wxa/msg_sec_check?access_token=access_token的具体值

    JavaScript案例如下:

    2020-01-19
    有用 1
    回复
  • o0o有脾气的酸奶
    o0o有脾气的酸奶
    2019-11-26


    2019-11-26
    有用
    回复
  • 郑栋🤔
    郑栋🤔
    2019-11-26

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

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

    2019-11-26
    有用
    回复
登录 后发表内容
问题标签