收藏
回答

安卓端调用微信授权登录失败?

weixinLo() {

// 点击前先判断是否同意协议

if (this.showAgree == false) {

uni.showToast({

icon: 'none',

position: 'bottom',

title: '请同意《用户协议》和《隐私政策》'

});

return false;

}

// 已经在登录中,避免重复点击

if (this.isSubmitting) {

return;

}

this.isSubmitting = true;

let that = this;

uni.login({

provider: 'weixin',

success: function(loginRes) {

that.$queue.showLoading('正在登录中...');

console.error(loginRes.authResult);

that.$queue.setData('weixinToken', loginRes.authResult.access_token);

that.$queue.setData('unionid', loginRes.authResult.unionid);

that.$queue.setData('weixinOpenid', loginRes.authResult.openid);

// 使用 POST 表单方式请求 wxAppLogin

that.$Request.post('/app/Login/wxAppLogin', {

token: loginRes.authResult.access_token,

unionid: loginRes.authResult.unionid,

wxOpenId: loginRes.authResult.openid

}).then(res => {

console.log(JSON.stringify(res))

if (res.code === 0) {

if (uni.getSystemInfoSync().platform == "android") {

let clientid = plus.push.getClientInfo().clientid;

that.$Request.postT('/app/login/updateClientId?clientId=' +

clientid + '&userId=' + res.user.userId).then(res => {


});

}

that.$queue.setData("token", res.token);

that.$queue.setData("userId", res.user.userId);

that.getUserInfo(res.user.userId, res.token);

} else {

uni.hideLoading();

uni.navigateTo({

url: '/pages/public/wxmobile'

});

}

}).finally(() => {

// 请求结束后恢复按钮状态

that.isSubmitting = false;

});

},

fail: function() {

that.isSubmitting = false;

uni.hideLoading();

uni.showToast({

icon: 'none',

title: '微信登录失败,请重试'

});

}

});

},

这是unipp开发的微信授权登录,之前一直都可以授权登录,现在准备上苹果端,所以在微信开放平台上添加了苹果端对应的信息,目前在审核中,今天发现安卓的微信授权登录就不行了

回答关注问题邀请回答
收藏
登录 后发表内容