收藏
回答

config:fail,invalid url domain 小程序和服务号都配置了,为什么还不行?

我需要在微信小程序webview中调用 微信扫一扫功能!

1,业务域名已经配了

2,签名也生成了

3,白名单也加了

为什么还是报config:fail,invalid url domain这个错误,微信小程序的webview网页调用应该不需要服务号相关配置吧,请帮忙看一下,微信小程序公众平台中我还需要配置一些什么才能满足要求

          console.log('response:', response.data)
          const nonceStr = that.generateNonceStr() // 随机字符串
          const timestamp = new Date().getTime() // 时间戳
          const url = window.location.href.split('#')[0] // 当前网页url
          const str =
            'jsapi_ticket=' +
            response.data +
            '&noncestr=' +
            nonceStr +
            '&timestamp=' +
            timestamp +
            '&url=' +
            url
          console.log('str:', str)
          const signature = that.sha1(str) // sha1加密
          let config = {
            debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
            appId: this.APPID, // 必填,公众号的唯一标识
            timestamp: timestamp, // 必填,生成签名的时间戳
            nonceStr: nonceStr, // 必填,生成签名的随机串
            signature: signature, // 必填,签名
            jsApiList: ['scanQRCode'] // 必填,需要使用的JS接口列表
          }
          console.log('config :', config)
          wx.config(config)


回答关注问题邀请回答
收藏

1 个回答

  • 智能回答 智能回答 本次回答由AI生成
    10-14
    有用
登录 后发表内容