微信小程序嵌套web-view,签名错误
签名使用的是公众号的appId和key,
String secret= "***" ;
|
//获取jsapi_ticket String url = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=" + access_token + "&type=jsapi" ; |
//将参数排序并拼接字符串 String str = "jsapi_ticket=" +jsapi_ticket+ "&noncestr=" +noncestr+ "×tamp=" +timestamp+ "&url=" +url; //将字符串进行sha1加密 String signature =SHA1(str); System.out.println( "参数:" +str+ "\n签名:" +signature); Map<String, Object> map = new HashMap<String, Object>(); map.put( "noncestr" , noncestr); map.put( "timestamp" , timestamp); map.put( "signature" , signature); urltime.put(url, timestamp); urlSign.put(url, map); return map; |
通过https://mp.weixin.qq.com/debug/cgi-bin/sandbox?t=jsapisign验证的签名正确。
但是在小程序中到用JSSDK 中api包无效签名错误。
请教是什么问题