C# Class ImgurNet.Authentication.OAuth2Authentication

Inheritance: IAuthentication
Afficher le fichier Open project: 0xdeafcafe/ImgurNet Class Usage Examples

Méthodes publiques

Méthode Description
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

Private Methods

Méthode Description
GrantTypeFromOAuthType ( OAuth2Type oAuth2Type ) : string

Generates a grant_type from the OAuth2 Type used in this authentication

Method Details

AuthorizeWithCode() public méthode

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.
Résultat System.Threading.Tasks.Task

AuthorizeWithPin() public méthode

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.
Résultat System.Threading.Tasks.Task

AuthorizeWithToken() public méthode

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.
Résultat void

CreateAuthorizationUrl() public méthode

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.
Résultat string

OAuth2Authentication() public méthode

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.
Résultat System

RefreshTokens() public méthode

Gets a new AccessToken and RefreshToken
public RefreshTokens ( ) : System.Threading.Tasks.Task
Résultat System.Threading.Tasks.Task