- 调用微信公众号新增临时素材成功(图片素材),但在公众号后台没有显示?
我用本地curl命令上传图片: [图片] 但是在公众号的多媒体素材页显示为空: [图片] 我的微信公众号id: gh_8ae19b6f947c
2020-12-24 - 中英文版文档内容不一致
https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/api/pre_auth_code.html[图片] [图片]
2020-12-18 - 授权入口页所在域名:空?请帮忙解决下
如下是我们构建的授权链接: https://mp.weixin.qq.com/cgi-bin/componentloginpage?component_appid=wx9aa1b9618d33bf62&pre_auth_code=preauthcode@@@CBeoNKSsW2QKVuytbu7EM2eQbecdhLzaTh9YBgW4J_na2dROTEqc02XgMkPs6gis&redirect_uri=http://c52c3b5fc027.ngrok.io/queryAuth 但是系统返回如下的错误提示: [图片] 在我的系统实现里,我是通过一个java spring controller来实现访问某个网址的时候,跳转到这个授权页面,详细的代码实现如下: @GetMapping("/redirectAuthPage") public String redirectAuthPage() { var urlString = UriComponentsBuilder.fromUriString(AUTHORIZATION_URL) .queryParam("component_appid", appId) .queryParam("pre_auth_code", wechatThirdPartyService.getPreauthCode()) .queryParam("redirect_uri", redirectUrl) .toUriString(); return "redirect:" + urlString; } } 在第三方平台的配置如下: [图片] 在往这个给定的网址发请求的时候,在测试的服务器端能得到302的返回结果。 GET /redirectAuthPage 302 Found
2020-10-26 - 第三方开放平台,调用获取令牌时返回40066, invalid url rid ?
在已经获取到component_verify_ticket的情况下,按照如下文档调用获取令牌的服务 https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/api/component_access_token.html 调用服务的代码如下: public ComponentTokenInfo getComponentAccessToken(String appId, String appSecret, String verifyTicket) { var requestMap = Map.of("component_appid", appId, "component_appsecret", appSecret, "component_verify_ticket", verifyTicket); try { var requestString = mapper.writeValueAsString(requestMap); var body = RequestBody.create(requestString, MediaType.parse("application/json")); var request = new Request.Builder().url(WECHAT_URL + "component_access_token").post(body).build(); var response = client.newCall(request).execute(); var responseString = response.body().string(); return mapper.readValue(responseString, ComponentTokenInfo.class); } catch (IOException e) { logger.error("error in getting component access token: ", e); throw new RuntimeException(e); } } {"errcode":40066,"errmsg":"invalid url rid: 5f9623b0-3a5e636c-481a8ee8"}
2020-10-26 - 微信开放平台调用获取预授权码错误,40066 invalid url?
我在获取到微信推送的component_verify_ticket之后,按照如下文档的说明,调用API来获取预授权码:https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/api/pre_auth_code.html 对应的调用代码如下: private static final String WECHAT_URL = "https://api.weixin.qq.com/cgi-bin/component/"; public PreauthCodeInfo getPreauthCode(String componentAccessToken, String appId) { var requestMap = Map.of("component_appid", appId); try { var requestString = mapper.writeValueAsString(requestMap); var body = RequestBody.create(requestString, MediaType.parse("application/json")); var urlString = UriComponentsBuilder.fromUriString(WECHAT_URL + "api_create_preauthcode") .queryParam("component_access_token", componentAccessToken) .toUriString(); var request = new Request.Builder().url(urlString).post(body).build(); var response = client.newCall(request).execute(); var responseString = response.body().string(); return mapper.readValue(responseString, PreauthCodeInfo.class); } catch (IOException e) { logger.error("error in getting preauth code: ", e); throw new RuntimeException(e); } } 返回的结果如下: {"errcode":40066,"errmsg":"invalid url rid: 5f9623b0-3a5e636c-481a8ee8"}
2020-10-26