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://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