We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
getUserId
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
企业微信第三方服务 WxCpTpUserServiceImpl,在调用 getUserId 接口时,是需要传 cropAccessToken 的,但在项目代码中,并没有进行设置 access 的地方,导致无法正常调用 API.
https://github.com/Wechat-Group/WxJava/blob/develop/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/tp/service/impl/WxCpTpUserServiceImpl.java#L189
@Override public String getUserId(String mobile) throws WxErrorException { JsonObject jsonObject = new JsonObject(); jsonObject.addProperty("mobile", mobile); String url = mainService.getWxCpTpConfigStorage().getApiUrl(GET_USER_ID); String responseContent = this.mainService.post(url, jsonObject.toString()); JsonObject tmpJsonElement = GsonParser.parse(responseContent); return tmpJsonElement.getAsJsonObject().get("userid").getAsString(); }
WxCpTpService wxCpTpService = new WxCpTpServiceImpl(); wxCpTpService.setWxCpTpConfigStorage(wecomSaasDefaultConfig); String wecomUserId = wxCpTpService.getWxCpTpUserService().getUserId("13000000000"); WxCpUser wecomUser2 = wxCpTpService.getWxCpTpUserService().getById(wecomUserId, enterpriseCorpConfig.getCorpId());
会报错误:
错误代码:41001, 错误信息:缺少access_token参数,微信原始报文:{"errcode":41001,"errmsg":"access_token missing, hint: [1661569918531331035431592]
JsonObject jsonObject = new JsonObject(); jsonObject.addProperty("mobile", staff.getPhoneNumber()); String userJson = wxCpTpService.post("https://qyapi.weixin.qq.com/cgi-bin/user/getuserid?access_token=" + accessToken, jsonObject.toString());
这样手工拼接 url 是可以成功的。
The text was updated successfully, but these errors were encountered:
欢迎直接PR代码进行修复
Sorry, something went wrong.
fix [ 企业微信第三方服务调用getUserId接口时缺少 access_token. issues binarywang#2799 ]
64b4856
6722098
88e346d
🐛 #2799 [ 企业微信】修复第三方服务调用getUserId接口时缺少access_token的问题
a8a5359
Successfully merging a pull request may close this issue.
简要描述
企业微信第三方服务 WxCpTpUserServiceImpl,在调用
getUserId
接口时,是需要传 cropAccessToken 的,但在项目代码中,并没有进行设置 access 的地方,导致无法正常调用 API.模块版本情况
详细描述
该接口的代码
https://github.com/Wechat-Group/WxJava/blob/develop/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/tp/service/impl/WxCpTpUserServiceImpl.java#L189
使用 WxJava 中的方法来调用:
会报错误:
手工调用
这样手工拼接 url 是可以成功的。
The text was updated successfully, but these errors were encountered: