Class OAuth2ClientBuilder
public class OAuth2ClientBuilder
- Inheritance
-
OAuth2ClientBuilder
- Inherited Members
Constructors
OAuth2ClientBuilder(string, string, Uri?, Uri?)
Create a new builder for creating OAuth2Clients.
public OAuth2ClientBuilder(string clientId, string clientSecret, Uri? tokenEndpoint = null, Uri? issuer = null)
Parameters
clientId
stringId of the client
clientSecret
stringSecret of the client
tokenEndpoint
UriEndpoint to receive the Access Token
issuer
UriIssuer of the Access Token. Used to automaticly receive the Token Endpoint while building
Remarks
Either tokenEndpoint
or issuer
must be provided.
Methods
AddRequestParameter(string, string)
Add a additional request parameter to each HTTP request.
public OAuth2ClientBuilder AddRequestParameter(string param, string paramValue)
Parameters
Returns
BuildAsync(CancellationToken)
Build the OAuth2Client with the provided properties of the builder.
public ValueTask<IOAuth2Client> BuildAsync(CancellationToken cancellationToken = default)
Parameters
cancellationToken
CancellationTokenCancellation token for this method
Returns
- ValueTask<IOAuth2Client>
Configured OAuth2Client
SetHttpClientHandler(HttpClientHandler)
Set custom HTTP Client handler for requests of the OAuth2 client.
public OAuth2ClientBuilder SetHttpClientHandler(HttpClientHandler handler)
Parameters
handler
HttpClientHandlerCustom handler for HTTP requests
Returns
SetScope(string)
Set the requested scopes for the client.
public OAuth2ClientBuilder SetScope(string scope)
Parameters
scope
stringOAuth scopes to request from the Issuer