公众号调用微信扫一扫失败?
// 微信扫一扫
export function scanCode(configData: any, callback: any) {
wx.config({
debug: true,
appId: configData.appId,
timestamp: configData.timestamp,
nonceStr: configData.noncestr,
signature: configData.signature,
jsApiList: jsApiList,
});
/* 处理成功验证 */
wx.ready(function () {
console.log('配置验证成功')
wx.scanQRCode({
needResult: 1,
scanType: ["qrCode", "barCode"],
success: function (res: any) {
console.log(res)
var result = res.resultStr;
callback(result);
},
});
});
}
注:const jsApiList = [
"checkJsApi",
"getLocation",
"scanQRCode",
"previewImage",
"startRecord",
"stopRecord",
"stopVoice",
"uploadVoice",
"translateVoice",
"downloadVoice",
"playVoice",
"chooseImage",
"uploadImage",
"onVoiceRecordEnd",
];
问题描述:wx.config验证也通过了,微信开发者工具报没有权限,详细截图如下:
[图片] 一开始怀疑是后台签名问题,后来在签名校验工具上也测试过,没有问题;微信公众平台的安全域名也配置过了;而且根据报错信息可看到获取到的jssdk权限只有三个,后来我试了一下previewImage,功能是正常的;所以现在不知道问题出在哪里了? 以下是微信公众平台开通的接口权限: [图片] [图片]