小程序
小游戏
企业微信
微信支付
扫描小程序码分享
在自己开发小程序时,在微信开发者工具中的真机调试使用完全没问题,同样的代码,上传通过审核上线后,数据能发送到我后台,但总提示缺少openid,也就是openid没获取成功或者是获取了一个空值。我在审核的时候勾选了获取用户信息的选项仍然没有解决。
请问这是什么原因?如何解决?
3 个回答
加粗
标红
插入代码
插入链接
插入图片
上传视频
你好,麻烦通过点击下方“反馈信息”按钮,提供出现问题的。
代码咋写的?全靠猜,是不是用wx.request直接请求微信接口了
wxLogin() {
wx.login({
success: (res) => {
if (res.code) {
wx.request({
url: 'https://api.weixin.qq.com/sns/jscode2session',
method: 'GET',
data: {
appid: config.APPID,
secret: config.APP_SECRET,
js_code: res.code,
grant_type: 'authorization_code'
},
success: (loginRes) => {
//其他内容
} else {
wx.showToast({
title: '失败',
icon: 'none'
});
}
代码判断在你手中,其他人怎么晓得,开发工具上都能获取,那就没问题,你这个错误提示,是通过code获取的时候提示的,还是其他情况提示的
关注后,可在微信内接收相应的重要提醒。
请使用微信扫描二维码关注 “微信开放社区” 公众号
代码咋写的?全靠猜,是不是用wx.request直接请求微信接口了
wxLogin() {
wx.login({
success: (res) => {
if (res.code) {
wx.request({
url: 'https://api.weixin.qq.com/sns/jscode2session',
method: 'GET',
data: {
appid: config.APPID,
secret: config.APP_SECRET,
js_code: res.code,
grant_type: 'authorization_code'
},
success: (loginRes) => {
//其他内容
} else {
wx.showToast({
title: '失败',
icon: 'none'
});
}
}
});
}
}
});
},
代码判断在你手中,其他人怎么晓得,开发工具上都能获取,那就没问题,你这个错误提示,是通过code获取的时候提示的,还是其他情况提示的
wxLogin() {
wx.login({
success: (res) => {
if (res.code) {
wx.request({
url: 'https://api.weixin.qq.com/sns/jscode2session',
method: 'GET',
data: {
appid: config.APPID,
secret: config.APP_SECRET,
js_code: res.code,
grant_type: 'authorization_code'
},
success: (loginRes) => {
//其他内容
} else {
wx.showToast({
title: '失败',
icon: 'none'
});
}
}
});
}
}
});
},