求助,vue页面(history模式路由)使用js-sdk突然报invalid signature

小游戏 企业微信 微信支付 小程序 文章 2020-07-30 21:04 964 0 全屏看文

AI助手支持GPT4.0

求助,vue页面(history模式路由)使用js-sdk突然报invalid signature
问题类型 API/组件名称 终端类型 微信版本 基础库版本
Bug wx.config 微信安卓客户端 6.5.3 1.2.0

按照官方排错文档仔仔细细排错了几遍,都没有发现问题。始终报invalid signature错误,报错也不详细,就一个invalid signature,我也不知道到底是哪里的问题。

之前是用hash模式路由,后来改为了history模式,但是给签名的url都是正确的,在微信js校验工具里面测试,签名也是正确的。

传入的地址是全地址,包含http://和路由地址。

麻烦各位大佬指点一下,但凡有一点办法,我也不会来这里求助。谢谢大佬们,下面放代码:

var strUrl = location.href.split('#')[0];$.ajax({    type: "Post",    url: "xxx",    data: JSON.stringify({        str: encodeURIComponent(strUrl)    }),    contentType: "application/json; charset=utf-8",    dataType: "json",    success: function(data) {        wxconifg(data.data);    },    error: function(jqXHR, textStatus, errorThrown) {}});function wxconifg(WXDate) {    wx.config({        debug: false,        appId: WXDate.appId,        timestamp: Number(WXDate.timestamp),   //1595837986        nonceStr: WXDate.nonceStr,   //7ba9788c-315d-4639-9176-a98cb607486d        signature: WXDate.signature, //d01eb9f4df70fbdf179bd3b45decd0b532bd9562        jsApiList: ["checkJsApi", "onMenuShareTimeline", "onMenuShareAppMessage", "onMenuShareQQ", "onMenuShareQZone",            "getLocalImgData", "chooseImage"        ],        fail: (err) => {            console.log('wx.config_errpr:', err);        }    });    wx.ready(function() {        wx.onMenuShareAppMessage(objInfo);        wx.onMenuShareTimeline(shareInfo);    });    wx.error(function(err) {        console.log('wx.error:', err)    });}

Problem type API / component name terminal type wechat version basic library version bug wx.config The wechat Android client 6.5.3 1.2.0 has been carefully arranged several times according to the official troubleshooting document, but no problem has been found. I always report invalid signature errors, but they are not detailed. I don't know where the problem is with an invalid signature. In the past, the hash mode was used for routing, and then the history mode was changed. However, the URL for the signature is correct. The signature is also correct when tested in the wechat JS verification tool. The incoming address is the full address, including http: / / and routing address. Please give me some advice. If there is any way, I will not come here for help. Thank you guys, the following code: VAR strurl= location.href.split ('#')[0];$.ajax({    type: "Post",    url: "xxx",    data: JSON.stringify ({        str: encodeURIComponent(strUrl)    }),    contentType: "application/json; charset=utf-8",    dataType: "json",     success: function(data) {        wxconifg( data.data );    },    error: function(jqXHR, textStatus, errorThrown) {}});function wxconifg(WXDate) {     wx.config ({        debug: false,        appId: WXDate.appId ,        timestamp: Number( WXDate.timestamp ), //1595837986        nonceStr: WXDate.nonceStr , //7ba9788c-315d-4639-9176-a98cb607486d        signature: WXDate.signature , //d01eb9f4df70fbdf179bd3b45decd0b532bd9562        jsApiList: ["checkJsApi", "onMenuShareTimeline", "onMenuShareAppMessage", "onMenuShareQQ", "onMenuShareQZone",            "getLocalImgData", "chooseImage"        ],         fail: (err) => {             console.log () wx.config_ errpr:', err);        }    });     wx.ready (function() {         wx.onMenuShareAppMessage (objInfo);         wx.onMenuShareTimeline (shareInfo);    });     wx.error (function(err) {         console.log () wx.error :', err)    });}

回答:

社区技术运营专员-娇华:

你好,有对照这里提供的解决方法么?https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/JS-SDK.html

MADAO:已经按照这个每一步都是检查过的,获取签名的url动态获取,也写死测试过,都没用,是突然这样报错的,以前是能正常使用
社区技术运营专员-娇华:微信版本是6.5.3?更新至最新版本再试试,还有问题的话,提供下问题机型、系统版本、微信版本、复现问题的链接
MADAO:测试的每种机型都有这个问题,系统安卓和IOS都有,微信版本新旧都有,复现链接是:https://service-bak.hulucc.com/h5/huluappfront/fathersDay/camera    麻烦帮忙看看,谢谢了
MADAO:

求各位大佬不惜赐教,谢谢啦

-EOF-

AI助手支持GPT4.0


国内超级便宜服务器

摸鱼人热门新闻聚合

钻级赞助商 我要加入

开发者在线工具

第三方支付技术请加QQ群

相关文章
这样两侧格子广告是哪里找的呢,求大神赐教?
添加了服务器的IP但是还是显示请提交付款接口调用IP
签名失败,验签失败
button中使用了loading,当做子组件使用,父组件中出现了异常情况?
按《快速上手》创建的三维项目体积超大,构建失败,如何瘦身?
随便看看
微信公众号免300认证教程 5892
小程序已经上线,作为管理员无法在小程序数据助手查看数据? 5299
小程序广告组件通过审核,但是小程序内没有显示广告? 5067
企业微信通讯录账号被管理员误/恶意删除,怎么办? 9568
问题? 9047
如何快速搭建抽奖助手小程序(无需代码知识) 6176
许涛 大哥在吗, 要解冻小程序的时候提示信息主体不一致, 能帮忙看下吗? 7471
小程序搜一搜全称搜索不显示 麻烦解决一下!谢谢 6792
我的小程序广告收款主体是个体工商户,每个月邮寄两次发票很是麻烦,我年底的时候打包邮寄一次可以么? 6126
如何解决渲染层网络错误Failed to load media? 17393