Browse Source

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

master
Binary Wang 6 years ago
parent
commit
a24b74603f
1 changed files with 6 additions and 1 deletions
  1. +6
    -1
      weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpOAuth2ServiceImpl.java

+ 6
- 1
weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/WxCpOAuth2ServiceImpl.java 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);
}


Loading…
Cancel
Save