C# Класс Imgur.API.Endpoints.Impl.OAuth2Endpoint

Authorizes account access.
Наследование: EndpointBase, IOAuth2Endpoint
Показать файл Открыть проект Примеры использования класса

Private Properties

Свойство Тип Описание
OAuth2Endpoint System

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

Метод Описание
GetAuthorizationUrl ( OAuth2ResponseType oAuth2ResponseType, string state = null ) : string

Creates an authorization url that can be used to authorize access to a user's account.

GetTokenByCodeAsync ( string code ) : Task

After the user authorizes, the pin is returned as a code to your application via the redirect URL you specified during registration, in the form of a regular query string parameter.

GetTokenByPinAsync ( string pin ) : Task

After the user authorizes, they will receive a PIN code that they copy into your app.

GetTokenByRefreshTokenAsync ( string refreshToken ) : Task

If a user has authorized their account but you no longer have a valid access_token for them, then a new one can be generated by using the refreshToken.

When your application receives a refresh token, it is important to store that refresh token for future use.

If your application loses the refresh token, you will have to prompt the user for their login information again.

OAuth2Endpoint ( IApiClient apiClient ) : System

Initializes a new instance of the OAuth2Endpoint class.

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

Метод Описание
OAuth2Endpoint ( IApiClient apiClient, HttpClient httpClient ) : System

Initializes a new instance of the OAuth2Endpoint class.

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

GetAuthorizationUrl() публичный метод

Creates an authorization url that can be used to authorize access to a user's account.
public GetAuthorizationUrl ( OAuth2ResponseType oAuth2ResponseType, string state = null ) : string
oAuth2ResponseType OAuth2ResponseType Determines if Imgur returns a Code, a PIN code, or an opaque Token.
state string /// This optional parameter indicates any state which may be useful to your application upon receipt of /// the response. ///
Результат string

GetTokenByCodeAsync() публичный метод

After the user authorizes, the pin is returned as a code to your application via the redirect URL you specified during registration, in the form of a regular query string parameter.
/// Thrown when a null reference is passed to a method that does not accept it as a /// valid argument. /// Thrown when an error is found in a response from an Imgur endpoint. Thrown when an error is found in a response from a Mashape endpoint.
public GetTokenByCodeAsync ( string code ) : Task
code string The code from the query string.
Результат Task

GetTokenByPinAsync() публичный метод

After the user authorizes, they will receive a PIN code that they copy into your app.
/// Thrown when a null reference is passed to a method that does not accept it as a /// valid argument. /// Thrown when an error is found in a response from an Imgur endpoint. Thrown when an error is found in a response from a Mashape endpoint.
public GetTokenByPinAsync ( string pin ) : Task
pin string The PIN that the user is prompted to enter.
Результат Task

GetTokenByRefreshTokenAsync() публичный метод

If a user has authorized their account but you no longer have a valid access_token for them, then a new one can be generated by using the refreshToken.

When your application receives a refresh token, it is important to store that refresh token for future use.

If your application loses the refresh token, you will have to prompt the user for their login information again.

/// Thrown when a null reference is passed to a method that does not accept it as a /// valid argument. /// Thrown when an error is found in a response from an Imgur endpoint. Thrown when an error is found in a response from a Mashape endpoint.
public GetTokenByRefreshTokenAsync ( string refreshToken ) : Task
refreshToken string
Результат Task

OAuth2Endpoint() публичный метод

Initializes a new instance of the OAuth2Endpoint class.
public OAuth2Endpoint ( IApiClient apiClient ) : System
apiClient IApiClient The type of client that will be used for authentication.
Результат System