我在开发H5授权时,第一步获取CODE,没有问题,第二步获取Openid时 提示{"errcode":40125,"errmsg":"invalid appsecret, view more at http:\/\/t.cn\/RAEkdVq, hints: [ req_id: F.fBJqyIRa-ztDGnA ]"}
微信APP ID: wx84099c4673821965,
我用APPID+secret生成Naive交易都没有问题,
如下:
string appid = "wx84099c4673821965";//"";
string body = "test";
string device_info = "0908AE088978";
string mch_id = "1558615201";
string nonce_str = "5K8264ILTKCH16CQ2502SI8ZNMTM67VS";
string notify_url = "http://www.iexbox.cn/wxpay";//"https://www.mii-fun.com/auth";
string out_trade_no = "7882332422322224314888998243";
string sign = "C380BEC2BFD727A4B6845133519F3AD6";
string spbill_create_ip="101.132.101.83";
string trade_type = "NATIVE";
string key = "XXXXXXXXXX"; //secret
string openid = "oIg4JuAZIo4S9xBq-iBAlgRXXpIg";
string total_fee = "88";
string signtext = "appid="+appid;
signtext+="&body="+body;
signtext+="&device_info="+device_info;
signtext+="&mch_id="+mch_id;
signtext+="&nonce_str="+nonce_str;
signtext+="¬ify_url="+notify_url;
signtext+="&openid="+openid;
signtext+="&out_trade_no="+out_trade_no;
signtext+="&spbill_create_ip="+spbill_create_ip;
signtext+="&total_fee="+total_fee;
signtext+="&trade_type="+trade_type;
signtext+="&key="+key;
md5(( char *)signtext.c_str(),sout);
cout<<"\r\nsign:"<<signtext<<endl;
sign = sout;
string text = "<xml>";
text += "<appid>"+appid+"</appid>";
text += "<body>" +body+"</body>";
text += "<device_info>"+device_info+"</device_info>";
text += "<mch_id>"+mch_id+"</mch_id>";
text += "<nonce_str>"+nonce_str+"</nonce_str>";
text += "<notify_url>"+notify_url+"</notify_url>";
text += "<openid>"+openid+"</openid>";
text += "<out_trade_no>"+out_trade_no+"</out_trade_no>";
text += "<spbill_create_ip>"+spbill_create_ip+"</spbill_create_ip>";
text += "<total_fee>"+total_fee+"</total_fee>";
text += "<trade_type>"+trade_type+"</trade_type>";
text += "<sign>"+sign+"</sign>";
text += "</xml>";
cout<<"\r\nOut:"<<text<<endl;
string response;
string api="/pay/unifiedorder";
int r= https_post_request("api.mch.weixin.qq.com", 443,(char *) api.c_str(),text,response);
但是,申请页面授权获取Openid报错,{"errcode":40125,"errmsg":"invalid appsecret, view more at http:\/\/t.cn\/RAEkdVq, hints: [ req_id: F.fBJqyIRa-ztDGnA ]"}
相关开发技术支持能够帮忙查查原因么,谢谢
微信后台能不能查到是否有自动重置的记录??
一.原因有两个
1.代码中设置的微信APPsecret和微信开放平台不一致,需要您自己对照微信开放平台和代码中的appsecret, 检查参数是否正确并且修正。
2.由于秘钥无效导致的,秘钥如果长时间不登录,会自动重置。
二.解决方法:重置秘钥,更换成重置后的秘钥,即可解决