#701 企业微信 网页授权登录 使用snsapi_userinfo、snsapi_privateinfo时需要使用agentid

This commit is contained in:
Binary Wang 2018-08-08 21:13:58 +08:00
parent 8c63f13387
commit a24b74603f

View File

@ -48,7 +48,12 @@ public class WxCpOAuth2ServiceImpl implements WxCpOAuth2Service {
url.append("&redirect_uri=").append(URIUtil.encodeURIComponent(redirectUri));
url.append("&response_type=code");
url.append("&scope=").append(scope);
if (WxConsts.OAuth2Scope.SNSAPI_PRIVATEINFO.equals(scope)
|| WxConsts.OAuth2Scope.SNSAPI_USERINFO.equals(scope)) {
url.append("&agentid=").append(this.mainService.getWxCpConfigStorage().getAgentId());
}
if (state != null) {
url.append("&state=").append(state);
}