Skip to content

Commit

Permalink
issue #105 WxCpService.oauth2buildAuthorizationUrl方法设计错误
Browse files Browse the repository at this point in the history
  • Loading branch information
chanjarster committed Feb 11, 2015
1 parent 2a439a6 commit b8d011e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -353,10 +353,11 @@ WxMediaUploadResult mediaUpload(String mediaType, String fileType, InputStream i
* 构造oauth2授权的url连接
* 详情请见: http://qydev.weixin.qq.com/wiki/index.php?title=企业获取code
* </pre>
* @param redirectUri
* @param state
* @return code
*/
String oauth2buildAuthorizationUrl(String state);
String oauth2buildAuthorizationUrl(String redirectUri, String state);

/**
* <pre>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -412,10 +412,10 @@ public void tagRemoveUsers(String tagId, List<String> userIds) throws WxErrorExc
}

@Override
public String oauth2buildAuthorizationUrl(String state) {
public String oauth2buildAuthorizationUrl(String redirectUri, String state) {
String url = "https://open.weixin.qq.com/connect/oauth2/authorize?" ;
url += "appid=" + wxCpConfigStorage.getCorpId();
url += "&redirect_uri=" + URIUtil.encodeURIComponent(wxCpConfigStorage.getOauth2redirectUri());
url += "&redirect_uri=" + URIUtil.encodeURIComponent(redirectUri);
url += "&response_type=code";
url += "&scope=snsapi_base";
if (state != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public WxCpXmlOutMessage handle(WxCpXmlMessage wxMessage, Map<String, Object> co
@Override
public WxCpXmlOutMessage handle(WxCpXmlMessage wxMessage, Map<String, Object> context,
WxCpService wxCpService, WxSessionManager sessionManager) {
String href = "<a href=\"" + wxCpService.oauth2buildAuthorizationUrl(null)
String href = "<a href=\"" + wxCpService.oauth2buildAuthorizationUrl(wxCpConfigStorage.getOauth2redirectUri(), null)
+ "\">测试oauth2</a>";
return WxCpXmlOutMessage
.TEXT()
Expand Down

0 comments on commit b8d011e

Please sign in to comment.