22

微信小程序获取openid等参数报错errcode:48001 errmsg:’api unauthorized’

 4 years ago
source link: http://mushiming.top/mushblog/archives/980
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

5 次查看

我的报这个错的时候,把url改成下面这个就可以了,

“https://api.weixin.qq.com/sns/jscode2session?appid=$appid&secret=$appsecret&js_code=$code&grant_type=authorization_code”

这个url有三种

1、$url = “https://api.weixin.qq.com/sns/oauth2/access_token?appid=$appid&secret=$appsecret&code=$code&grant_type=authorization_code”;

2、$url = “https://api.weixin.qq.com/sns/oauth2/component/access_token?appid=$appid&secret=$appsecret&code=$code&grant_type=authorization_code”;

3、$url = “https://api.weixin.qq.com/sns/jscode2session?appid=$appid&secret=$appsecret&js_code=$code&grant_type=authorization_code”;

赞赏

fIr2AfU.jpg!web 微信赞赏 JBfe2q7.jpg!web 支付宝赞赏

BVfeeun.png!web

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK