mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-07-15 23:13:31 +08:00
issue #105 WxCpService.oauth2buildAuthorizationUrl方法设计错误
This commit is contained in:
parent
2a439a6690
commit
b8d011e73e
@ -353,10 +353,11 @@ public interface WxCpService {
|
||||
* 构造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>
|
||||
|
@ -412,10 +412,10 @@ public class WxCpServiceImpl implements WxCpService {
|
||||
}
|
||||
|
||||
@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) {
|
||||
|
@ -62,7 +62,7 @@ public class WxCpDemoServer {
|
||||
@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()
|
||||
|
Loading…
Reference in New Issue
Block a user