C# Класс Mondo.MondoAuthorizationClient

Mondo API authorization client.
Наследование: IMondoAuthorizationClient
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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.

Приватные методы

Метод Описание
AuthorizeAsync ( string>.Dictionary formValues, CancellationToken cancellationToken = newCancellationToken() ) : Task
MondoAuthorizationClient ( HttpClient httpClient, string clientId, string clientSecret ) : System

Initialises a new MondoAuthorizationClient

Описание методов

AuthenticateAsync() публичный Метод

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.
Результат Task

Dispose() публичный Метод

Disposes the underlying HttpClient.
public Dispose ( ) : void
Результат void

GetAccessTokenAsync() публичный Метод

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.
Результат Task

GetAuthorizeUrl() публичный Метод

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.
Результат string

MondoAuthorizationClient() публичный Метод

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.
Результат System

RefreshAccessTokenAsync() публичный Метод

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.
Результат Task