C# Class Imgur.API.Endpoints.Impl.OAuth2Endpoint

Authorizes account access.
Inheritance: EndpointBase, IOAuth2Endpoint
ファイルを表示 Open project: DamienDennehy/Imgur.API Class Usage Examples

Private Properties

Property Type Description
OAuth2Endpoint System

Public Methods

Method Description
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.

Private Methods

Method Description
OAuth2Endpoint ( IApiClient apiClient, HttpClient httpClient ) : System

Initializes a new instance of the OAuth2Endpoint class.

Method Details

GetAuthorizationUrl() public method

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

GetTokenByCodeAsync() public method

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

GetTokenByPinAsync() public method

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

GetTokenByRefreshTokenAsync() public method

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
return Task

OAuth2Endpoint() public method

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