在后台调用getuserphonenumber接口一直报错,是不能在后台用吗?

小程序 文章 2022-03-07 14:20 799 0 全屏看文

AI助手支持GPT4.0

在后台调用getuserphonenumber接口一直报错,是不能在后台用吗?Calling the getuserphonenumber interface in the background keeps reporting an error. Can it be used in the background?

在后台调用getuserphonenumber接口一直报错,是不能在后台用吗?

小程序需要获取手机号,通过界面按钮获取code值后,提交给后台获取手机号:

1、通过接口:https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=""&secret=""获取到access_token值后调用接口:

2、https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token='+access_token+"&code="+phoneCode,调用后提示:

data format error hint: [Wgdbr7Ore-oEm.7] rid: 62259c4a-7c28684e-6eb764dc

The applet needs to obtain the mobile phone number. After obtaining the code value through the interface button, submit it to the background to obtain the mobile phone number: 1. Through the interface: https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid= "" & Secret = "" get access "_ Token value after calling interface: 2, https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token= '+access_ Token + "& code =" + phonecode, prompt after calling: data format error hint: [wgdbr7ore OEM. 7] rid: 62259c4a-7c28684e-6eb764dc

回答:

拾忆:

需要通过用户触发button按钮返回的code才可以。

再见,电脑崽:

微信的请求都是POST的而且数据是json格式,文档稍微有点误导:

curl -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"code": "e31968a7f94cc5ee25fafc2aef2773f0bb8c3937b22520eb8ee345274d00c144"}' https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token=ACCESS_TOKEN
VBit:

code不要写在url里面

~^_^~:去掉了提示错误码40029,invalid code hint: [DGdb9_I2e-ve1C6a] rid: 6225a161-6f4c1862-196a5fd3
~^_^~:可以了,谢谢,code值用过一次了

-EOF-

AI助手支持GPT4.0


国内超级便宜服务器

摸鱼人热门新闻聚合

钻级赞助商 我要加入

开发者在线工具

第三方支付技术请加QQ群

相关文章
试用小程序快速认证,提交信息经常提示 法人姓名与微信号不一致是怎么回事?
小程序客服按钮,第一次进去时,可以主动给用户发个消息吗?
open-type="share"默认的屏幕截图可以设置大小以及具体截图的位置吗?
如何查找企业认证下的50家微信公众号名单?
text中文本没有设计点击样式,但是点击底下会出现下划线?
随便看看
微信公众号免300认证教程 5892
小程序已经上线,作为管理员无法在小程序数据助手查看数据? 5299
小程序广告组件通过审核,但是小程序内没有显示广告? 5067
企业微信通讯录账号被管理员误/恶意删除,怎么办? 9568
问题? 9047
如何快速搭建抽奖助手小程序(无需代码知识) 6177
许涛 大哥在吗, 要解冻小程序的时候提示信息主体不一致, 能帮忙看下吗? 7471
小程序搜一搜全称搜索不显示 麻烦解决一下!谢谢 6793
我的小程序广告收款主体是个体工商户,每个月邮寄两次发票很是麻烦,我年底的时候打包邮寄一次可以么? 6127
如何解决渲染层网络错误Failed to load media? 17393