Skip to content

Commit 3a09a61

Browse files
author
璀境石
authored
🐛 #3208 【企业微信】修复OAuth2服务getAuthUserInfo字段大小写问题导致无法获取返回数据的问题
1 parent 605d77d commit 3a09a61

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpOAuth2Service.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,16 @@ public interface WxCpOAuth2Service {
102102

103103
/**
104104
* <pre>
105-
* 使用user_ticket获取成员详情.
105+
* 使用user_ticket获取成员详情
106106
*
107-
* 文档地址:https://work.weixin.qq.com/api/doc#10028/%E4%BD%BF%E7%94%A8user_ticket%E8%8E%B7%E5%8F%96%E6%88%90%E5%91%98%E8%AF%A6%E6%83%85
107+
* 文档地址:https://developer.work.weixin.qq.com/document/path/95833
108108
* 请求方式:POST(HTTPS)
109-
* 请求地址:https://qyapi.weixin.qq.com/cgi-bin/user/getuserdetail?access_token=ACCESS_TOKEN
109+
* 请求地址:https://qyapi.weixin.qq.com/cgi-bin/auth/getuserdetail?access_token=ACCESS_TOKEN
110110
*
111-
* 权限说明:
112-
* 需要有对应应用的使用权限,且成员必须在授权应用的可见范围内。
111+
* 注意: 原/cgi-bin/user/getuserdetail接口的url已变更为/cgi-bin/auth/getuserdetail,旧接口暂时还可以使用,但建议使用新接口
112+
*
113+
* 权限说明:需要有对应应用的使用权限,且成员必须在授权应用的可见范围内。
114+
* 适用范围:企业内部开发、服务商代开发
113115
* </pre>
114116
*
115117
* @param userTicket 成员票据

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpOAuth2ServiceImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@ public WxCpOauth2UserInfo getAuthUserInfo(String code) throws WxErrorException {
115115
JsonObject jo = GsonParser.parse(responseText);
116116

117117
return WxCpOauth2UserInfo.builder()
118-
.userId(GsonHelper.getString(jo, "UserId"))
119-
.openId(GsonHelper.getString(jo, "OpenId"))
118+
.userId(GsonHelper.getString(jo, "userid"))
119+
.openId(GsonHelper.getString(jo, "openid"))
120120
.userTicket(GsonHelper.getString(jo, "user_ticket"))
121121
.externalUserId(GsonHelper.getString(jo, "external_userid"))
122122
.build();

weixin-java-cp/src/main/java/me/chanjar/weixin/cp/constant/WxCpApiPathConsts.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ interface OAuth2 {
143143
/**
144144
* The constant GET_USER_DETAIL.
145145
*/
146-
String GET_USER_DETAIL = "/cgi-bin/user/getuserdetail";
146+
String GET_USER_DETAIL = "/cgi-bin/auth/getuserdetail";
147147
/**
148148
* The constant URL_OAUTH2_AUTHORIZE.
149149
*/

0 commit comments

Comments
 (0)