小程序授权异常问题

3792关注11568浏览

线上的是可以的,就开发版和体验版有这样的情况



在测试时,发现在点击授权的时候,经常不会弹出授权弹框,而且能拿到加密数据,然后到后台去解析的时候就报解析失败。

就从下午开始一直出现这样的问题。


具体代码是这样的:

<button open-type="getUserInfo" bindgetuserinfo="getUserInfo">



// 全局获取用户信息
getUserInfo: function (res, type, callback) {
let _this = this;
   // console.log('---获取用户信息---');
   // console.log(res);
   // console.log('----------');
   if (res.detail.errMsg == 'getUserInfo:fail auth deny') {
wx.showModal({
title: '用户授权',
           content: '本小程序需用户授权,请重新点击按钮授权。',
           mask: true,
           confirmColor: '#F45C43',
           success: function (res) {
}
})
} else if (res.detail.errMsg == 'getUserInfo:ok') {
let userInfo = res.detail.userInfo;
       _this.globalData.userInfo = userInfo;
       wx.setStorageSync('userinfo', userInfo);
       callback({
hasUserInfo: true,
           userInfo: userInfo
});
       _this.wxLogin(res.detail.encryptedData, res.detail.iv, type)
}
},
//授权登录,拿token
wxLogin: function (encryptedData, iv, type) {
wx.setStorageSync('userType', type);//user登录方式,sell,buy
   // body...
   wx.login({
success: function (res) {
"use strict";
           if (res.code) {
let params = {
appid: API.APP_ID,
                   code: res.code,
                   encryptedData: encryptedData,
                   iv: iv
               };
        &n
展开全部
收起
1回答
提交回答
  • 至过去的我

    2044人对此回答表示赞同

    我是未来的你,你现在是不是在年找寻小程序答案。你不要感觉诧异,给你来信原因,就是让你不在后悔。今天去学习如何推广小程序,相信......点击查看更多>
    发布于
  • Jacob

    11人对此回答表示赞同

    展开
    11
    0回复
    发布于 6年前

    评论(0)

    收起评论

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
咨询热线

13312967497

扫码添加业务即可随时咨询 还可领取小程序推广攻略

业务咨询: 13312967497
扫码咨询

扫码咨询套餐

回到顶部