public Task <Uri> CreateRequestUriAsync(OAuth2UriRequestOptions options) { options = options ?? new OAuth2UriRequestOptions(); options.State = options.State ?? Guid.NewGuid().ToString(); return(Task.Run(() => { var request = this.CreateRequestUriRestRequest(options); return this.RestClient.BuildUri(request); })); }
protected virtual RestRequest CreateRequestUriRestRequest(OAuth2UriRequestOptions options) { var request = new RestRequest(this.AuthorizationEndpoint.AbsoluteUri); request .AddQueryParameter("client_id", this.ClientId) .AddQueryParameter( "redirect_uri", (options.OverrideRedirectUri ?? this.RedirectUri).AbsoluteUri) .AddQueryParameter("state", options.State) .AddQueryParameter("response_type", options.OverrideResponseType ?? "code") .AddQueryParameter("scope", string.Join(" ", options.Scope)) .AddQueryParameters(options.CustomParameters); return(request); }