C# Class ImgurNet.Authentication.OAuth2Authentication

Inheritance: IAuthentication
ファイルを表示 Open project: 0xdeafcafe/ImgurNet Class Usage Examples

Public Methods

Method 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

Method Description
GrantTypeFromOAuthType ( OAuth2Type oAuth2Type ) : string

Generates a grant_type from the OAuth2 Type used in this authentication

Method Details

AuthorizeWithCode() public method

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.
return System.Threading.Tasks.Task

AuthorizeWithPin() public method

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.
return System.Threading.Tasks.Task

AuthorizeWithToken() public method

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.
return void

CreateAuthorizationUrl() public method

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.
return string

OAuth2Authentication() public method

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.
return System

RefreshTokens() public method

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