File tree Expand file tree Collapse file tree
weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -387,6 +387,18 @@ public interface WxMpService {
387387 */
388388 public String oauth2buildAuthorizationUrl (String scope , String state );
389389
390+ /**
391+ * <pre>
392+ * 构造oauth2授权的url连接
393+ * 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=网页授权获取用户基本信息
394+ * </pre>
395+ * @param redirectURI
396+ * 用户授权完成后的重定向链接,无需urlencode, 方法内会进行encode
397+ * @param scope
398+ * @param state
399+ * @return code
400+ */
401+ public String oauth2buildAuthorizationUrl (String redirectURI , String scope , String state );
390402 /**
391403 * <pre>
392404 * 用code换取oauth2的access token
Original file line number Diff line number Diff line change @@ -363,9 +363,14 @@ public WxMpSemanticQueryResult semanticQuery(WxMpSemanticQuery semanticQuery) th
363363
364364 @ Override
365365 public String oauth2buildAuthorizationUrl (String scope , String state ) {
366+ return this .oauth2buildAuthorizationUrl (wxMpConfigStorage .getOauth2redirectUri (), scope , state );
367+ }
368+
369+ @ Override
370+ public String oauth2buildAuthorizationUrl (String redirectURI , String scope , String state ) {
366371 String url = "https://open.weixin.qq.com/connect/oauth2/authorize?" ;
367372 url += "appid=" + wxMpConfigStorage .getAppId ();
368- url += "&redirect_uri=" + URIUtil .encodeURIComponent (wxMpConfigStorage . getOauth2redirectUri () );
373+ url += "&redirect_uri=" + URIUtil .encodeURIComponent (redirectURI );
369374 url += "&response_type=code" ;
370375 url += "&scope=" + scope ;
371376 if (state != null ) {
You can’t perform that action at this time.
0 commit comments