1***@qq.com
1***@qq.com
  • 发布:2020-12-28 16:42
  • 更新:2020-12-28 16:42
  • 阅读:1041

【报Bug】app 微信登录,拉不起微信登录界面

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: win10

HBuilderX类型: 正式

HBuilderX版本号: 2.9.8

手机系统: Android

手机系统版本号: Android 9.0

手机厂商: 华为

手机机型: STF-AL00

页面类型: vue

打包方式: 云端

项目创建方式: HBuilderX

示例代码:
// 获取登录页面授权认证服务  
            getServices(){  
                this.aweixin = null;  
                let auths = {};  
                plus.oauth.getServices(services =>{  
                    console.log(services)  
                    for(var i in services){  
                        auths[services[i].id] = services[i];  
                    }  
                    this.aweixin = auths['weixin'];  
                    // this.weixinAppLogin();  
                }, function(e){  
                    plus.nativeUI.alert("获取登录授权服务列表失败:"+JSON.stringify(e));  
                } );  
            },  
            // app微信登录  
            weixinAppLogin(){  
                this.$request("/api/wechat/oauth-state","GET",{},true).then( res =>{  
                    console.log(res.data.state,"11212")  
                    let state = res.data.state  
                    if(!this.aweixin){  
                        plus.nativeUI.alert("当前环境不支持微信登录");  
                        return;  
                    }  
                    this.aweixin.authorize(e =>{  
                        console.log(e)  
                        this.$request("/api/wechat/oauth-callback/app","GET",{code:e.code,state:state},true).then(res =>{  
                            console.log(res,"用户信息1")  
                        })  
                    }, e =>{  
                        plus.nativeUI.alert("授权失败:"+JSON.stringify(e));  
                    });  
                })  
            },   

操作步骤:

https://www.html5plus.org/doc/zh_cn/oauth.html#plus.oauth.AuthService,直接按照官方文档来弄

预期结果:

拉起微信登录

实际结果:

没有拉起微信登录,返回40029,无效的 oauth_code

bug描述:

uniapp,运行到华为荣耀9 真机调试,没有拉起微信登录界面,直接获取code。

2020-12-28 16:42 负责人:无 分享
已邀请:

该问题目前已经被锁定, 无法添加新回复