C# Class Mondo.MondoAuthorizationClient

Mondo API authorization client.
Inheritance: IMondoAuthorizationClient
Exibir arquivo Open project: rdingwall/mondo.net Class Usage Examples

Public Methods

Method Description
AuthenticateAsync ( string username, string password, CancellationToken cancellationToken = newCancellationToken() ) : Task

Acquires an OAuth2.0 access token. An access token is tied to both your application (the client) and an individual Mondo user and is valid for several hours.

Dispose ( ) : void

Disposes the underlying HttpClient.

GetAccessTokenAsync ( string authorizationCode, string redirectUri, CancellationToken cancellationToken = newCancellationToken() ) : Task

Exchange this authorization code for an AccessToken, allowing requests to be mande on behalf of a user.

GetAuthorizeUrl ( string state = null, string redirectUri = null ) : string

Generates a Mondo OAuth authorization URL based on state and redirect.

MondoAuthorizationClient ( string clientId, string clientSecret, string baseUri = "https://api.getmondo.co.uk" ) : System

Initialises a new MondoAuthorizationClient

RefreshAccessTokenAsync ( string refreshToken, CancellationToken cancellationToken = newCancellationToken() ) : Task

Exchange this authorization code for an AccessToken, allowing requests to be mande on behalf of a user.

Private Methods

Method Description
AuthorizeAsync ( string>.Dictionary formValues, CancellationToken cancellationToken = newCancellationToken() ) : Task
MondoAuthorizationClient ( HttpClient httpClient, string clientId, string clientSecret ) : System

Initialises a new MondoAuthorizationClient

Method Details

AuthenticateAsync() public method

Acquires an OAuth2.0 access token. An access token is tied to both your application (the client) and an individual Mondo user and is valid for several hours.
public AuthenticateAsync ( string username, string password, CancellationToken cancellationToken = newCancellationToken() ) : Task
username string The user’s email address.
password string The user’s password.
cancellationToken System.Threading.CancellationToken A cancellation token that can be used by other objects or threads to receive notice of cancellation.
return Task

Dispose() public method

Disposes the underlying HttpClient.
public Dispose ( ) : void
return void

GetAccessTokenAsync() public method

Exchange this authorization code for an AccessToken, allowing requests to be mande on behalf of a user.
public GetAccessTokenAsync ( string authorizationCode, string redirectUri, CancellationToken cancellationToken = newCancellationToken() ) : Task
authorizationCode string The authorization code.
redirectUri string The URL the user should be redrected back to.
cancellationToken System.Threading.CancellationToken A cancellation token that can be used by other objects or threads to receive notice of cancellation.
return Task

GetAuthorizeUrl() public method

Generates a Mondo OAuth authorization URL based on state and redirect.
public GetAuthorizeUrl ( string state = null, string redirectUri = null ) : string
state string State which will be passed back to you to prevent tampering.
redirectUri string The URI we will redirect back to after an authorization by the resource owner.
return string

MondoAuthorizationClient() public method

Initialises a new MondoAuthorizationClient
public MondoAuthorizationClient ( string clientId, string clientSecret, string baseUri = "https://api.getmondo.co.uk" ) : System
clientId string Your client ID.
clientSecret string Tour client secret.
baseUri string URL of the Mondo API to use, defaults to production.
return System

RefreshAccessTokenAsync() public method

Exchange this authorization code for an AccessToken, allowing requests to be mande on behalf of a user.
public RefreshAccessTokenAsync ( string refreshToken, CancellationToken cancellationToken = newCancellationToken() ) : Task
refreshToken string The refresh token.
cancellationToken System.Threading.CancellationToken A cancellation token that can be used by other objects or threads to receive notice of cancellation.
return Task