C# 클래스 Google.Apis.Auth.OAuth2.UserCredential

OAuth 2.0 credential for accessing protected resources using an access token, as well as optionally refreshing the access token when it expires using a refresh token.
상속: IHttpExecuteInterceptor, IHttpUnsuccessfulResponseHandler, IConfigurableHttpClientInitializer
파일 보기 프로젝트 열기: Gainedge/BetterExplorer 1 사용 예제들

공개 메소드들

메소드 설명
HandleResponseAsync ( Google.Apis.Http.HandleUnsuccessfulResponseArgs args ) : Task
Initialize ( Google.Apis.Http.ConfigurableHttpClient httpClient ) : void
InterceptAsync ( HttpRequestMessage request, CancellationToken taskCancellationToken ) : Task

Default implementation is to try to refresh the access token if there is no access token or if we are 1 minute away from expiration. If token server is unavailable, it will try to use the access token even if has expired. If successful, it will call IAccessMethod.Intercept.

RefreshTokenAsync ( CancellationToken taskCancellationToken ) : Task

Refreshes the token by calling to Google.Apis.Auth.OAuth2.Flows.IAuthorizationCodeFlow.RefreshTokenAsync. Then it updates the TokenResponse with the new token instance.

UserCredential ( IAuthorizationCodeFlow flow, string userId, Google.Apis.Auth.OAuth2.Responses.TokenResponse token ) : System

Constructs a new credential instance.

메소드 상세

HandleResponseAsync() 공개 메소드

public HandleResponseAsync ( Google.Apis.Http.HandleUnsuccessfulResponseArgs args ) : Task
args Google.Apis.Http.HandleUnsuccessfulResponseArgs
리턴 Task

Initialize() 공개 메소드

public Initialize ( Google.Apis.Http.ConfigurableHttpClient httpClient ) : void
httpClient Google.Apis.Http.ConfigurableHttpClient
리턴 void

InterceptAsync() 공개 메소드

Default implementation is to try to refresh the access token if there is no access token or if we are 1 minute away from expiration. If token server is unavailable, it will try to use the access token even if has expired. If successful, it will call IAccessMethod.Intercept.
public InterceptAsync ( HttpRequestMessage request, CancellationToken taskCancellationToken ) : Task
request System.Net.Http.HttpRequestMessage
taskCancellationToken System.Threading.CancellationToken
리턴 Task

RefreshTokenAsync() 공개 메소드

Refreshes the token by calling to Google.Apis.Auth.OAuth2.Flows.IAuthorizationCodeFlow.RefreshTokenAsync. Then it updates the TokenResponse with the new token instance.
public RefreshTokenAsync ( CancellationToken taskCancellationToken ) : Task
taskCancellationToken System.Threading.CancellationToken Cancellation token to cancel an operation.
리턴 Task

UserCredential() 공개 메소드

Constructs a new credential instance.
public UserCredential ( IAuthorizationCodeFlow flow, string userId, Google.Apis.Auth.OAuth2.Responses.TokenResponse token ) : System
flow IAuthorizationCodeFlow Authorization code flow.
userId string User identifier.
token Google.Apis.Auth.OAuth2.Responses.TokenResponse An initial token for the user.
리턴 System