微信互助信息,服务端调用接口 setuserinteractivedata 一直签名错误
https://developers.weixin.qq.com/minigame/dev/api-backend/open-api/data/storage.setUserInteractiveData.html #代码逻辑 List list=new ArrayList<>();
list.add(new KeyValue("1",0));
Map kv_list2 = new HashMap<>();
kv_list2.put("kv_list", list);
String jsonKv= JSONObject.toJSONString(kv_list2);
System.out.println("待签名的kv:"+jsonKv+" sessionKey:"+sessionKey);
String signature = new SHA1().getDigestOfString((jsonKv+ sessionKey).getBytes());
System.out.println("kv生成签名:"+signature);
String setUrl = "https://api.weixin.qq.com/wxa/setuserinteractivedata?access_token="+accessToken+"&signature="+signature+"&openid="+openid+"&sig_method=hmac_sha256";
Map setMap = new HashMap<>();
setMap.put("kv_list", jsonKv);
System.out.println("请求地址:"+setUrl);
String out=RestTemplateUtils.post(setUrl,setMap,header,String.class, MediaType.APPLICATION_JSON_UTF8);
System.out.println("微信返回值:"+out);
return out;
#日志打印 待签名的kv:{"kv_list":[{"key":"1","value":0}]} sessionKey:XUqblv2lGZZcAEmMAikEtw==
kv生成签名:A21A3397FE8038C7036B00E635DD1709D3DB2DED
请求地址:https://api.weixin.qq.com/wxa/setuserinteractivedata?access_token=32_8pajMfTb9eyrkyeVJZGoZlYhXCATiufEIT13NEWUAWKoVplszfY_yqMwgc8q-wUBeG0jp9ohSvspXwU_OpuG0qXE-DMs9_R1YrtFSXf3-TyxHz0dPXp-9tIQz0Jru5DKVPhqofvFK7DazaE0UVUdAFAPQP&signature=A21A3397FE8038C7036B00E635DD1709D3DB2DED&openid=ofN9a5DMpYKQMCcMcDpKjiGOL5gE&sig_method=hmac_sha256
微信返回值:{"errcode":87009,"errmsg":"invalid signature hint: [GgiBFl4FE-yvycxa]"}
签名到底是用什么参数做加密?具体加密的内容有哪些?有没有一个可用的例子供参考一下