微信小程序获取同主体的微信公众号文章报错:
{"errcode":48001,"errmsg":"api unauthorized, hints: [ req_id: 1QoCla0699ns81 ]"}
原因:
在小程序中获取微信的文章,报这个错,原来是获取access_token的时候,appid和AppSecret写成小程序的了,应该是微信公众号的appid和AppSecret,然后添加ip白名单。
注意:
- 微信小程序和微信公众号的appid和AppSecret不一样,调用微信公众号的接口,要用微信公众号的。
- 只有启用了微信公共号的AppSecret 之后,才会出现添加ip白名单的选项,才能添加ip白名单。