收藏
回答

急!调用wx.authorize 返回12007错误

框架类型 问题类型 操作系统 工具版本
小程序 Bug Windows 1.02.1807120
  1. {errMsg: "authorize:fail scope unauthorized", errCode: "-12007"}

    1. errCode:"-12007"

    2. errMsg:"authorize:fail scope unauthorized"

    3. __proto__:Object



用户机型:苹果7plus



代码部分:

wx.login({

success: function () {

wx.getUserInfo({

withCredentials: true,

success: function (res) {

//此处为获取微信信息后的业务方法

that.globalData.userInfo = res.userInfo;

typeof cb == "function" && cb(that.globalData.userInfo)

},

fail: function () {

//获取用户信息失败后。请跳转授权页面

wx.showModal({

title: '警告',

content: '尚未进行授权,请点击确定跳转到授权页面进行授权。',

success: function (res) {

if (res.confirm) {

console.log('用户点击确定')

wx.navigateTo({

url: '/pages/tologin/tologin',

})

}

},fail(e){

console.log("用户授权失败")

console.log(e);

}

})

}

})

}

});


最后一次编辑于  2018-07-17
回答关注问题邀请回答
收藏

3 个回答

  • Andy
    Andy
    2019-12-16

    现在只能通过button 按钮点击获取授权,否则只会失败,不要问为什么。

    2019-12-16
    有用 3
    回复
  • 為謀
    為謀
    2019-08-27

    我也是这个问题 ,老是报这个errMsg"authorize:fail 系统错误,错误码:-12007,scope unauthorized"

    wx.authorize({
              scope: 'scope.userInfo',
              success(res){
                console.log('pppp', res)
                wx.getUserInfo({
                  success:res=>{
                    console.log('pppp',res)
                    wx.setStorage({
                      key: 'permissions',
                      data: res,
                    })
                  }
                   
                })
              }, fail: err => {
                wx.showToast({
                  title: '失败',
                })
                console.error('失败:', err)
              }
            })
          }


    2019-08-27
    有用
    回复 1
  • 李良山
    李良山
    2018-07-17

    最好贴出来按钮和JS的代码

    2018-07-17
    有用
    回复 7
    • 淡定
      淡定
      2018-07-17

      贴出来了,指导下呗,谢谢

      2018-07-17
      回复
    • 李良山
      李良山
      2018-07-17回复淡定

      wx.getUserInfo早就废弃了,肯定不能用了啊,要用点按钮获取

      2018-07-17
      回复
    • 淡定
      淡定
      2018-07-17回复李良山

      这个要怎么改呢?

      2018-07-17
      回复
    • 李良山
      李良山
      2018-07-17回复淡定

      用 button 组件的获取用户信息接口,具体参考 button 组件

      2018-07-17
      1
      回复
    • Chris🌝
      Chris🌝
      2019-09-11回复李良山
      废弃了,文档里没说啊
      2019-09-11
      回复
    查看更多(2)
登录 后发表内容