wx.getUserProfile接口用户同意授权后,scope.userInfo不为true?

小程序 文章 2021-03-03 09:41 450 0 全屏看文

AI助手支持GPT4.0

wx.getUserProfile接口用户同意授权后,scope.userInfo不为true?After wx.getUserProfile interface user agrees to authorization, scope.userInfo is not true?

wx.getUserProfile接口用户同意授权后,scope.userInfo不为true?

根据公告https://developers.weixin.qq.com/community/develop/doc/000cacfa20ce88df04cb468bc52801?highLine=wx.getUserProfile提到的一点

若开发者调用wx.getSetting接口请求用户的授权状态,会直接读取到scope.userInfo为true


目前wx.getUserProfile接口用户同意授权后,scope.userInfo不为true


According to the announcement https://developers.weixin.qq.com/community/develop/doc/000cacfa20ce88df04cb468bc52801?highLine=wx.getUserProfile As mentioned, if the developer calls wx.getSetting The interface requests the authorization status of the user and reads it directly scope.userInfo Is true at present wx.getUserProfile After the interface user agrees to authorize, scope.userInfo Not true

回答:

苏军:

机制已经变了,你理解的是以前的逻辑,要是一样改接口就没意义了

豆浆油条:那如果在调用wx.getUserProfile接口后,如果想要encryptedData和iv的话,又需要弹窗授权了
Brother斌🎈:

wx.getUserProfile会返回昵称地区等信息不会返回encryptedData和iv,wx.getUserInfo会返回encryptedData和iv和匿名的昵称等信息,

wx.getUserProfile每次调用都会弹一次弹框,wx.getUserInfo调用不会再弹出弹框

豆浆油条:但是wx.getUserInfo,在调用时需要判断wx.setting下的scope.userInfo,如果不为true,是调用不成功的
Brother斌🎈:不用啊 你可以直接调wx.getUserInfo啊
豆浆油条:调用会直接报错,拿不到iv等信息的
Brother斌🎈:scope.userInfo为true是代表用户在wx.getUserInfo弹框点了允许,4月13号后发布的版本wx.getUserInfo不会再弹框,所以scope.userInfo会默认为true
Brother斌🎈:我现在在上线的小程序都没调setting,哪来的报错
豆浆油条:4月13号之前,调用wx.getuserInfo会弹窗,以及弹窗后用户点击允许需要scope.userInfo为true。那如果4月13号之前先调用getUserProfile会弹窗,如果需要iv等信息的话调用getUserInfo也会在弹一次窗了

-EOF-

AI助手支持GPT4.0