新用户在getUserProfile的弹窗允许后能否直接调用getUserInfo接口?

小程序 文章 2021-04-01 13:42 97 0 全屏看文

新用户在getUserProfile的弹窗允许后能否直接调用getUserInfo接口?Can a new user directly call the getUserInfo interface after the pop-up window of getUserProfile allows it?

新用户在getUserProfile的弹窗允许后能否直接调用getUserInfo接口?

js代码片段如图

wxml文件写法<button bindtap="getUserProfileclass='authBtnlang='zh_CN'>{{chance_yes}}</button>,用这种写法弹窗点击允许getUserInfo接口会报错getUserInfo:fail scope unauthorized

wxml文件写法<button bindtap="getUserProfileclass='authBtnopenType='getUserInfolang='zh_CN'>{{chance_yes}}</button>,用这种写法第一次点击弹窗允许时,两个接口都没有返回信息控制台除了1111111111没有任何东西。只有当第二次点击按钮弹窗并允许时,才会正常返回。

因为业务需求,两个接口都需要调用,如何让新用户只授权一次,就能使两个接口都返回

JS code fragment is as shown in the figure, wxml file writing < button bindtap = "getuserprofile" class = - authbtn 'lang = - zh_ CN'>{{chance_ Yes} < / button >, in this way, clicking the getUserInfo interface in the pop-up window will report an error tUserInfo:fail scope The writing method of unauthorized wxml file_ CN'>{{chance_ Yes} < / button >, in this way, when you click the pop-up window for the first time, neither of the two interfaces returns to the information console, and there is nothing except 1111. Only when you click the button pop-up for the second time and allow it, will you return normally. Because of business requirements, both interfaces need to be called. How to make a new user authorize only once to make both interfaces return

回答:

Brother斌🎈:

业务不需要,旧getUserInfo所需要的东西可以根据wx.login和wx.getUserProfile获取到

维她命系:

为什么要一起调用?

-EOF-