gogogo
管理员
管理员
  • UID25
  • 粉丝0
  • 关注0
  • 发帖数1377
阅读:1902回复:0

H5公众号errMsg: “onMenuShareAppMessage:fail, the permission value is offline verifying“

楼主#
更多 发布于:2022-05-19 17:57
H5公众号 在调用 jweixin-module 时
config:fail,Error: 系统错误,错误码:63002,invalid signature [20201120 15:37:13][]


errMsg: “onMenuShareAppMessage:fail, the permission value is offline verifying”


第一个错:63002,询问后台是否有解析url,前台需要传url 给后台
var surl = encodeURIComponent(window.location.href.split('#')[0]);

第二个错:检查jsApiList 中是否添加了 updateAppMessageShareData

jsApiList: ["updateAppMessageShareData", "updateTimelineShareData"]







最后附上跑通的代码希望对读者有帮助




// npm 安装 'jweixin-module
npm install jweixin-module --save








// 公众号分享
wxjssdks() {
var surl = encodeURIComponent(window.location.href.split('#')[0]);
const _this = this;
const wx = require('jweixin-module');
console.log(wx)
let obj = {
url: surl
}
wxjssdk(obj).then(response => {
let res = response.data
// let wxjs = JSON.parse(res.wxjs)
console.log(res.wxjs)
wx.config({
 debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
 appId: res.wxjs.appId, // 和获取Ticke的必须一样------必填,公众号的唯一标识
 timestamp: res.wxjs.timestamp, // 必填,生成签名的时间戳
 nonceStr: res.wxjs.nonceStr, // 必填,生成签名的随机串
 signature: res.wxjs.signature, // 必填,签名,见附录1
 //需要分享的列表项:发送给朋友,分享到朋友圈,分享到QQ,分享到QQ空间
 jsApiList: ["updateAppMessageShareData", "updateTimelineShareData"]
});
if (res.codes === '200') {
//处理验证成功的信息
wx.ready(function() {
//处理验证失败的信息
wx.error(function(err) {
console.log(err)
});
 //分享到朋友圈
 wx.updateTimelineShareData({
title: res.shareinfo.title ? res.shareinfo.title : '', // 分享标题
desc: res.shareinfo.desc ? res.shareinfo.desc : '',
link: res.shareinfo.link ? res.shareinfo.link : window.location.href, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
imgUrl: res.shareinfo.pic ? res.shareinfo.pic : '', // 分享图标
success: function(res) {
 // 用户确认分享后执行的回调函数
 // _this.shareSuccess(res);
}
 });
 //分享给朋友
 wx.updateAppMessageShareData({
title: res.shareinfo.title ? res.shareinfo.title : '', // 分享标题
desc: res.shareinfo.desc ? res.shareinfo.desc : '',
link: res.shareinfo.link ? res.shareinfo.link : window.location.href, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
imgUrl: res.shareinfo.pic ? res.shareinfo.pic : '', // 分享图标
type: "", // 分享类型,music、video或link,不填默认为link
dataUrl: "", // 如果type是music或video,则要提供数据链接,默认为空
success: function(res) {
 // 用户确认分享后执行的回调函数
}
 });
});
}
}).catch(error => {
console.log(error)
})
},








https://blog.csdn.net/weixin_44097578/article/details/109854106
游客


返回顶部