还没到4.13,getUserInfo:fail scope unauthorized?
发布于 5 年前 作者 hren 9667 次浏览 来自 官方Issues

wx.getUserProfile

4.8日上线小程序,兼容处理了wx.getUserProfile,请问下现在的生产环境下wx.getUserProfile

返回的是不是true。

另外为什么在使用之前的getUserInfo的时候会出现getUserInfo:fail scope unauthorized

2 回复

getUserInfo:fail scope unauthorized 原因是需要先通过button的openType="getUserInfo"先进行授权,同意后才可以用 wx.getUserInfo 直接获取用户信息。

2.10.4以下版本getUserInfo将不受影响,2.10.4开始getUserInfo将直接返回匿名信息。 getUserProfile在2.10.4开始只返回userInfo,2.16.0开始会返回iv等信息。

周知:getUserInfo 开发版 & 体验版 已对齐 getUserInfo 匿名表现,正式版将于 4月13日 正式对齐 getUserInfo 匿名表现。请开发者使用 getUserProfile 获取用户信息。开发版 & 体验版 scope.userInfo 调整将于 4月13日 对齐。

pc微信暂不支持wx.getUserProfile,可以参考示例代码进行兼容

https://developers.weixin.qq.com/miniprogram/dev/api/open-api/user-info/wx.getUserProfile.html#%E7%A4%BA%E4%BE%8B%E4%BB%A3%E7%A0%81

小程序登录、用户信息相关接口调整说明:https://developers.weixin.qq.com/community/develop/doc/000cacfa20ce88df04cb468bc52801

回到顶部