C# Класс ImgurNet.Authentication.OAuth2Authentication

Наследование: IAuthentication
Показать файл Открыть проект Примеры использования класса

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

Метод Описание
AuthorizeWithCode ( string code ) : System.Threading.Tasks.Task

Gets the token set from the code in the query string of the callback url. Throws a if the code is not valid.

AuthorizeWithPin ( string pin ) : System.Threading.Tasks.Task

Gets the token set from the pin the user has inputted. Throws a if the pin is not valid.

AuthorizeWithToken ( string accessToken, string refreshToken, int expiresIn, string authorizedUsername ) : void

Authorizes with the tokens that you recieved from the url in CreateAuthorizationUrl

CreateAuthorizationUrl ( OAuth2Type responseType, string state = null ) : string

Creates the Authorization Url, that the user will visit to allow your application to access their user account. For more information on how OAuth2 on Imgur works, visit their Developer Section (https://api.imgur.com/oauth2)

OAuth2Authentication ( string clientId, string clientSecret, bool checkRateLimit ) : System

Creates a new Imgur Authorization based off of a client's ClientId.

RefreshTokens ( ) : System.Threading.Tasks.Task

Gets a new AccessToken and RefreshToken

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

Метод Описание
GrantTypeFromOAuthType ( OAuth2Type oAuth2Type ) : string

Generates a grant_type from the OAuth2 Type used in this authentication

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

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

Gets the token set from the code in the query string of the callback url. Throws a if the code is not valid.
public AuthorizeWithCode ( string code ) : System.Threading.Tasks.Task
code string The code from the callback Url.
Результат System.Threading.Tasks.Task

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

Gets the token set from the pin the user has inputted. Throws a if the pin is not valid.
public AuthorizeWithPin ( string pin ) : System.Threading.Tasks.Task
pin string The pin the user entered.
Результат System.Threading.Tasks.Task

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

Authorizes with the tokens that you recieved from the url in CreateAuthorizationUrl
public AuthorizeWithToken ( string accessToken, string refreshToken, int expiresIn, string authorizedUsername ) : void
accessToken string The you recieved.
refreshToken string The you recieved.
expiresIn int The you recieved.
authorizedUsername string The Username of the account that has been authorized.
Результат void

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

Creates the Authorization Url, that the user will visit to allow your application to access their user account. For more information on how OAuth2 on Imgur works, visit their Developer Section (https://api.imgur.com/oauth2)
public CreateAuthorizationUrl ( OAuth2Type responseType, string state = null ) : string
responseType OAuth2Type /// The type of response you want to use. It's recomended that; /// - Pin: Desktop/Server/Mobile Applications /// - Code: Desktop/Server/Mobile Applications /// - Token: Javascript Applications ///
state string The state you want to pass through auth. This will be given back to you from the re-direct url if you use Code or Token Authentication.
Результат string

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

Creates a new Imgur Authorization based off of a client's ClientId.
public OAuth2Authentication ( string clientId, string clientSecret, bool checkRateLimit ) : System
clientId string The ClientId of your imgur client. Create one here (https://api.imgur.com/oauth2/addclient).
clientSecret string The ClientSecret of your imgur client. Create one here (https://api.imgur.com/oauth2/addclient).
checkRateLimit bool Check, and populate the current ratelimit status of your client.
Результат System

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

Gets a new AccessToken and RefreshToken
public RefreshTokens ( ) : System.Threading.Tasks.Task
Результат System.Threading.Tasks.Task