微信第三方平台代公众号发起网页授权 48001 api unauthorized 问题

https://api.weixin.qq.com/sns/oauth2/access_token?appid=APPID&secret=SECRET&code=CODE&grant_type=authorization_cod
 
这个为普通公众号调用模式。
--------------------------------------------------------------
 
 
以下为第三方平台服务端调用模式:
通过code换取access_token获取 openid的接口得用
https://api.weixin.qq.com/sns/oauth2/component/access_token?appid=APPID&code=CODE&grant_type=authorization_code&component_appid=COMPONENT_APPID&component_access_token=COMPONENT_ACCESS_TOKEN 这个接口,(此接口是open.weixin.qq.com里面提供的)注意看这个接口跟上面接口的区别 ,以及参数的区别。 此接口的所有参数都可以获取到。但是要注意的是调用此接口有可能会出现48001 api unauthorized 这个错误 ,引起这个错误的原因是

    component_access_token   这个参数  注意看文档  服务开发方的access_token不是公众账号授权给第三方平台后返回的
    access_token。  这个参数的值需要通过  https://api.weixin.qq.com/cgi-bin/component/api_component_token这个接口获取
     
    完美解决48001 api unauthorized

原文地址:https://www.cnblogs.com/Fooo/p/12033927.html