Exemple #1
0
 /**
  * 返回带{@code state}参数的授权url,授权回调时会带上这个{@code state}
  *
  * @param state state 验证授权流程的参数,可以防止csrf
  * @return 返回授权地址
  * @since 1.9.3
  */
 public override string authorize(string state)
 {
     return(UrlBuilder.fromBaseUrl(source.authorize())
            .queryParam("appid", config.clientId)
            .queryParam("redirect_uri", GlobalAuthUtil.urlEncode(config.redirectUri))
            .queryParam("response_type", "code")
            .queryParam("scope", config.scope.IsNullOrWhiteSpace() ? "snsapi_login" : config.scope)
            .queryParam("state", getRealState(state))
            .build());
 }