html52.com
我爱小程序-开发者交流社区

小程序获取用户手机号遇到问题?

String url="https://api.weixin.qq.com/wxa/business/getuserphonenumber?scope=snsapi_userinfo&access_token=ACCESS_TOKEN&code=CODE";
url = url.replace("ACCESS_TOKEN", token).replace("CODE", code);
String postResult = HttpUtil.post(url, "{}");



{"errcode":40029,"errmsg":"invalid code hint: [XfmcTVNre-vGNNia] rid: 628da727-52e5b3c7-79315d09"}

网友回复

Mr.YAO:

请参考示例

https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/phonenumber/phonenumber.getPhoneNumber.html

code 以 JSON 字符串格式写在 POST 请求的 body 中

Lipeng:

这个接口要传入code参数的。可通过前端bindgetphonenumber获得

https://developers.weixin.qq.com/miniprogram/dev/component/button.html

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

真正的个人免签约支付接口

云免签H5支付