问下各位有没有遇到过这个问题,使用的是下面这个这个包,在本地使用微信的sdk,去访问微信公众号获取tocken是没有问题的。
在将服务部署到微信云托管后,获取tocken时候报错。
<dependency>
<groupId>com.github.binarywang</groupId>
<artifactId>weixin-java-mp</artifactId>
<version>3.3.0</version>
</dependency>
报出下面的错误
org.apache.http.client.HttpResponseException: status code: 502, reason phrase: Bad Gateway java.lang.RuntimeException: org.apache.http.client.HttpResponseException: status code: 502, reason phrase: Bad Gateway at me.chanjar.weixin.mp.api.impl.WxMpServiceHttpClientImpl.getAccessToken(WxMpServiceHttpClientImpl.java:91) at me.chanjar.weixin.mp.api.impl.BaseWxMpServiceImpl.executeInternal(BaseWxMpServiceImpl.java:318) at me.chanjar.weixin.mp.api.impl.BaseWxMpServiceImpl.execute(BaseWxMpServiceImpl.java:283) at me.chanjar.weixin.mp.api.impl.BaseWxMpServiceImpl.post(BaseWxMpServiceImpl.java:272) at me.chanjar.weixin.mp.api.impl.WxMpTemplateMsgServiceImpl.sendTemplateMsg(WxMpTemplateMsgServiceImpl.java:36)
你好,使用微信云托管可以免鉴权调用小程序/公众号微信开放接口,免证书调用微信支付接口,可参考文档https://developers.weixin.qq.com/miniprogram/dev/wxcloudrun/src/guide/weixin/
当前问题,可以前往微信云托管控制台-服务管理-云调用中关闭开放接口服务。