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

我的报这个错的时候,把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/accesstoken?appid=url = “https://api.weixin.qq.com/sns/oauth2/access_token?appid=url=https://api.weixin.qq.com/sns/oauth2/accesstoken?appid=appid&secret=$appsecret&code=$code&grant_type=authorization_code”;

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

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


发表评论

电子邮件地址不会被公开。 必填项已用*标注