login_before(type, navigateBack = true) {
if (!this.agree && type != 'univerify') {
return uni.showToast({
title: this.$t('common').noAgree,
icon: 'none'
});
}
uni.showLoading({
mask: true
})
uni.login({
"provider": type,
"onlyAuthorize":true, //请勿直接使用前端获取的unionid或openid直接用于登录,前端的数据都是不可靠的
"univerifyStyle": this.univerifyStyle,
complete: (e) => {
uni.hideLoading()
console.log(e);
},
success: async e => {
console.log(e);
if (type == 'apple') {
let res = await this.getUserInfo({
provider: "apple"
})
Object.assign(e.authResult, res.userInfo)
}
this.login( type == 'weixin'?e.code:e.authResult , type)
},

- 发布:2021-10-20 17:16
- 更新:2021-10-20 17:16
- 阅读:1762
产品分类: uniapp/App
PC开发环境操作系统: Windows
PC开发环境操作系统版本号: win10
HBuilderX类型: 正式
HBuilderX版本号: 3.2.9
手机系统: Android
手机系统版本号: Android 11
手机厂商: 华为
手机机型: harmonyOS
页面类型: vue
打包方式: 云端
项目创建方式: HBuilderX
示例代码:
操作步骤:
uni-starter
app端使用微信登录
uni-starter
app端使用微信登录
预期结果:
正常
正常
实际结果:
报错,invalid code
报错,invalid code
bug描述:
用最新的uni-starter环境部署好后调用uni.login接口也获取不到code
0 个回复