C# 클래스 Imgur.API.Endpoints.Impl.OAuth2Endpoint

Authorizes account access.
상속: EndpointBase, IOAuth2Endpoint
파일 보기 프로젝트 열기: DamienDennehy/Imgur.API 1 사용 예제들

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