1***@163.com
1***@163.com
  • 发布:2025-09-11 12:34
  • 更新:2025-09-11 14:34
  • 阅读:57

通过uni.login获取的code值传给后端,后端获取openid一直报错40029。大佬们有遇到类似问题吗

分类:uni-app
wx.login({  
            provider: 'weixin',  
            onlyAuthorize: true, // 仅获取code,不处理敏感信息  
            success: (loginRes) => {  
                console.log('loginRes',loginRes);  

                uni.$http({  
                    url: "/driver/getWxOpenIdByApp",  
                    method: "post",  
                    data: {  
                        wxId: loginRes.code,  
                        id:uni.getStorageSync("driver").id,  
                    }  
                }).then((e) => {  
                    if (e.code === '200') {  
                        uni.showToast({  
                            title: `授权登录成功`,  
                            icon: "success"  
                        });  
                    }  
                });  

            },  
            })
2025-09-11 12:34 负责人:无 分享
已邀请:
爱豆豆

爱豆豆 - 办法总比困难多

检查一下前后端是不是用的同一个appid

  • 1***@163.com (作者)

    manifest文件里的吗,与后端是一致的

    2025-09-11 13:37

DCloud_UNI_yuhe

DCloud_UNI_yuhe

可以看一下这个文章: https://ask.dcloud.net.cn/question/206687

  • 1***@163.com (作者)

    不行,自定义基座和正式包都不行T-T

    2025-09-11 15:51

要回复问题请先登录注册