小程序获取 密文 encryptedData
发布于 5 年前 作者 bzhang 7423 次浏览 来自 问答

我是开发者, 为什么我获取不到 这两个信息? 大神???  只能获取一个code

code______033T0Zs80d0HDG1kuQv80TTLs80T0Zsf

encryptedData_____undefined

iv_____undefined

1 回复

wx.login()只能获取code,要获取更多信息,需要用 __ <button open-type=“getUserInfo”></button> 引导用户主动进行授权操作__

__
__

如下:

<!-- 需要使用 button 来授权登录 -->
<button  open-type="getUserInfo" bindgetuserinfo="bindGetUserInfo">授权登录</button>
 
bindGetUserInfo: function(e) {
    console.log(e.detail.userInfo);//这里就有你想要的信息
 }
回到顶部