-
-
Notifications
You must be signed in to change notification settings - Fork 9.1k
企业微信OAuth2.0缺少对snsapi_userinfo和snsapi_privateinfo的支持 #697
Copy link
Copy link
Closed
Description
企业微信OAuth2.0缺少snsapi_userinfo和snsapi_privateinfo
@Override
public String buildAuthorizationUrl(String redirectUri, String state) {
String url = "https://open.weixin.qq.com/connect/oauth2/authorize?";
url += "appid=" + this.mainService.getWxCpConfigStorage().getCorpId();
url += "&redirect_uri=" + URIUtil.encodeURIComponent(redirectUri);
url += "&response_type=code";
url += "&scope=snsapi_base";
if (state != null) {
url += "&state=" + state;
}
url += "#wechat_redirect";
return url;
}
weixin-java-cp中WxCpOAuth2ServiceImpl类
@Override
public String[] getUserInfo(Integer agentId, String code) throws WxErrorException {
String url = String.format("https://qyapi.weixin.qq.com/cgi-bin/user/getuserinfo?code=%s&agentid=%d",
code, agentId);
String responseText = this.mainService.get(url, null);
JsonElement je = new JsonParser().parse(responseText);
JsonObject jo = je.getAsJsonObject();
return new String[]{GsonHelper.getString(jo, "UserId"),
GsonHelper.getString(jo, "DeviceId"),
GsonHelper.getString(jo, "OpenId")};
}
中得到的userTicket没有返回
无法调用
getUserDetail(String userTicket)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels