Skip to content

Commit a24b746

Browse files
committed
#701 企业微信 网页授权登录 使用snsapi_userinfo、snsapi_privateinfo时需要使用agentid
1 parent 8c63f13 commit a24b746

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,12 @@ public String buildAuthorizationUrl(String redirectUri, String state, String sco
4848
url.append("&redirect_uri=").append(URIUtil.encodeURIComponent(redirectUri));
4949
url.append("&response_type=code");
5050
url.append("&scope=").append(scope);
51-
51+
52+
if (WxConsts.OAuth2Scope.SNSAPI_PRIVATEINFO.equals(scope)
53+
|| WxConsts.OAuth2Scope.SNSAPI_USERINFO.equals(scope)) {
54+
url.append("&agentid=").append(this.mainService.getWxCpConfigStorage().getAgentId());
55+
}
56+
5257
if (state != null) {
5358
url.append("&state=").append(state);
5459
}

0 commit comments

Comments
 (0)