收藏
回答

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

AppID
wxdeaa3ebc0b644b08

一直抱这个错误,小程序和服务号都配置了,为什么还不行,服务号是新申请的,还么有认证,这个影响吗?

代码如下

const nonceStr = 'Wm3WZYTPz0wzccnW' // 随机字符串
          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接口列表
          }
               wx.config(config)
回答关注问题邀请回答
收藏

3 个回答

登录 后发表内容
问题标签