请问getPhoneNumber接口中上送的code是通过wx.login接口获取的吗?
code送值问题?code delivery problem?
code送值问题?请问getPhoneNumber接口中上送的code是通过wx.login接口获取的吗?
Excuse me, the code submitted in the getphonenumber interface is through Wx Is it obtained through the login interface?
回答:
为啥你们后端给你写解密手机号还需要传一个code?参数应该都是从bindgetphonenumber这个事件获取到的参数才对。
新版本不需要
// wxml<button open-type="getPhoneNumber" bindgetphonenumber="getUserPhone" />// jsgetUserPhone(e) { if (e.detail.errMsg != 'getPhoneNumber:ok') return wx.showLoading({ title: '注册中...' }) HTTP({ url: 'xxxxxx', data: { code: e.detail.code } }).then(res => { // ...... })}
原文出处:code送值问题?
手机号获取凭证
code
并非wx.login
获取的code
,而是button
组件open-type="getPhoneNumber"
通过bindgetphonenumber
事件回调获取的,具体参考手机号获取文档。