在浏览器端,第三方应用平台调用 wx.config() 没问题,但调用 wx.agentConfig() 一直报 42012。几经排查确认,jsapi_ticket 的获取方式和参数跟官方文档一致,烦请帮忙排查下。
agentConfig 接口调用参数,调用时间(Wed Jul 21 2021 10:23:06 GMT+0800 (中国标准时间)):
{"config":{"corpid":"ww8a9bcc5fa21806ee","agentid":"1000008","timestamp":"1626834186163","nonceStr":"z0yXqkOqnfw4fyKg","signature":"1e9f883aeb54bbdfd8ba6b42e694cdb55648fdf0","jsApiList":["selectExternalContact"],"url":"http://ling-marketing-dev.jd.com/channel/qiwei/overview"},"sid":"tqccb6IISuW1H5wGmAOpS2pDU/iWz6kg1DXffWZicJgodbdxAeM2hF3gcRr9VGGeN8m1PJbP4oiRJjGjxU7Y+Ak8R7xBQbxApTQXH3DNjD5aCriyOWauBbnCu5R6D8bP1Vkk+U3gnq34VI5JEkIMZg=="}
agentConfig 接口响应:
{"data":{"err_Info":"fail","errMsg":"agentConfig:fail","hint":"Hint: '0721102306:8H/FWZEAZqmt9q0T64ORrg:42012'. More info at https://open.work.weixin.qq.com/devtool/query?e=42012"}}
你好,看日志就是提示签名不一致,确认下使用的ticket是否是通过获取应用的ticket获取的,https://work.weixin.qq.com/api/doc/90000/90136/90506#%E8%8E%B7%E5%8F%96%E5%BA%94%E7%94%A8%E7%9A%84jsapi_ticket,还有就是你这个应用的可信域名跟url的域名不一致
{"config":{"corpid":"ww8a9bcc5fa21806ee","agentid":"1000010","timestamp":"1627020879896","nonceStr":"tvF2tq6JJazFG0eC","signature":"960e5d21f9540f96cce2972a205968d984b68cc8","jsApiList":[],"url":"https://ling-marketing.jd.com/channel/qiwei/overview"},"sid":"dj09RmzVBWXromLLzXmQfk9up/GOissqGpfymePGqHOsDP495r0heegMC7KkaFcAC9ljwDaB7QejCbrdF8JLvOkT/vUNQH2VHkLPwkVTOEEPo76tHL8Iv/b67KJ7BkAzlCvypl9Y1tGT42/zMVVQ0P/Kf7QYg+uspfiW7QapFWM="}
{"data":{"err_Info":"fail","errMsg":"agentConfig:fail","hint":"Hint: '0723141440:He6wvyTSdaU3RWJl4VbPzg:42012'. More info at https://open.work.weixin.qq.com/devtool/query?e=42012"}}
你好,请问下是否解决了?我这边也是一样提示这样的问题。
使用官方的签名效验工具提示正常。
token为 MtoUnMEmVlienTFG7CODaA== [corpid] => wwc946810a1d1102d5 [agentid] => 1000002 [nonceStr] => bZ7zULKsiT [timestamp] => 1633776851 [url] => http://scrm.insintek.com/index/index/tool [signature] => 97485844a10e4a6f7be08b152c3f8528529d022d
wx.config({"debug":false,"beta":false,"jsApiList":["updateAppMessageShareData","updateTimelineShareData"],"openTagList":[],"appId":"wwc946810a1d1102d5","nonceStr":"SfYflhK4Tb","timestamp":1633776851,"url":"http:\/\/scrm.insintek.com\/index\/index\/tool","signature":"e8078ce506c0f38a5af46fb8268e5b97b9afa45e"}); wx.ready(function(){ wx.agentConfig({ //调用agentConfig "debug":true,"beta":true, corpid: 'wwc946810a1d1102d5', agentid: 1000002, timestamp: 1633776851, nonceStr: 'bZ7zULKsiT', signature: '97485844a10e4a6f7be08b152c3f8528529d022d', jsApiList: ['selectExternalContact'], success: function(res) { wx.invoke('getCurExternalContact', { }, function(res){ if(res.err_msg == "getCurExternalContact:ok"){ userId = res.userId ; //返回当前外部联系人userId document.write(userId); }else { document.write("ASASAS"); } }); }, fail: function(res) { if(res.errMsg.indexOf('function not exist') > -1){ alert('版本过低请升级') } } }); });