亿奇科技
亿奇科技
  • 发布:2022-09-26 17:40
  • 更新:2022-11-28 17:39
  • 阅读:913

微信登录报错:业务参数配置缺失errCode:-7

分类:uni-app

manifest.json中的appid和AppSecret都与微信开放平台中的相符,在真机调试及自定义基座调试当中会报错:
{"errMsg":"login:fail 业务参数配置缺失,http://ask.dcloud.net.cn/article/282","errCode":-7,"code":-7}
哪位大佬能帮忙看看找一下原因。

wxLogin(){  
                // #ifdef APP-PLUS  
                    uni.showLoading({  
                        mask:true,  
                        title:'正在拉起微信'  
                    })  
                    uni.login({  
                        provider:'weixin',  
                        // onlyAuthorize: true,  
                        success:res=>{  
                            uni.hideLoading();  
                            if(res.errMsg != 'login:ok')  
                            {  
                                return this.$showToast('系统异常ERROR');  
                            }  
                            uni.getUserInfo({  
                                  provider: 'weixin',  
                                  success:result=>{  
                                      console.log(result)  
                                    if(result.errMsg != 'getUserInfo:ok')  
                                    {  
                                        return this.$showToast('登录失败,系统异常ERROR');  
                                    }  
                                    this.$http('/api/app/login.php',{  
                                        wx_openid:result.userInfo.openId  
                                    }).then(res=>{  
                                        console.log(res);  
                                        if(res.code == 0)  
                                        {  
                                            uni.setStorageSync('USERINFO',res.USERINFO);  
                                            getApp().globalData.USERINFO = res.USERINFO;  
                                            return uni.switchTab({  
                                                url:'/pages/tabbar/home'  
                                            })  
                                        }  
                                    })  
                                },  
                                fail:err=> {  
                                    console.log(err);  
                                }  
                            });  
                        },  
                        fail:err=>{  
                            uni.hideLoading();  
                            console.log(err);  
                            if(err.errMsg == 'login:fail')  
                            {  
                                return this.$showToast('请先同意获取授权');  
                            }  
                        }  
                    })  
                // #endif  
            }
2022-09-26 17:40 负责人:无 分享
已邀请:
DCloud_UNI_Anne

DCloud_UNI_Anne

用的哪个版本HBuilderX呢?之前是否正常?改成appsecret重新打自定义基座试下呢?

by畅

by畅

遇到同样问题。请问解决了吗?

n***@outlook.com

n***@outlook.com

遇到同样的问题了 ,有没有大佬能解决一下吗?

1***@qq.com

1***@qq.com

手机端真机调试需要先调用uni.login接口,拿到手机上微信绑定的账号权限,再调用uni.getUserProfile接口就能拿到数据了,我是这样解决的。

要回复问题请先登录注册