File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed
weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -387,6 +387,18 @@ public interface WxMpService {
387
387
*/
388
388
public String oauth2buildAuthorizationUrl (String scope , String state );
389
389
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 );
390
402
/**
391
403
* <pre>
392
404
* 用code换取oauth2的access token
Original file line number Diff line number Diff line change @@ -363,9 +363,14 @@ public WxMpSemanticQueryResult semanticQuery(WxMpSemanticQuery semanticQuery) th
363
363
364
364
@ Override
365
365
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 ) {
366
371
String url = "https://open.weixin.qq.com/connect/oauth2/authorize?" ;
367
372
url += "appid=" + wxMpConfigStorage .getAppId ();
368
- url += "&redirect_uri=" + URIUtil .encodeURIComponent (wxMpConfigStorage . getOauth2redirectUri () );
373
+ url += "&redirect_uri=" + URIUtil .encodeURIComponent (redirectURI );
369
374
url += "&response_type=code" ;
370
375
url += "&scope=" + scope ;
371
376
if (state != null ) {
You can’t perform that action at this time.
0 commit comments