public static GetActiveUserToken ( |
||
cancellationToken | ||
refresh | bool | |
리턴 | Task |
/// <summary> /// Asynchronously revokes the token by calling /// <see cref="Google.Apis.Auth.OAuth2.Flows.IAuthorizationCodeFlow.RevokeTokenAsync"/>. /// </summary> /// <param name="taskCancellationToken">Cancellation token to cancel an operation.</param> /// <returns><c>true</c> if the token was revoked successfully.</returns> public async Task <bool> RevokeTokenAsync(CancellationToken taskCancellationToken) { TokenResponse userToken = await ActiveUserConfig.GetActiveUserToken(taskCancellationToken); await flow.RevokeTokenAsync("userId", userToken.AccessToken, taskCancellationToken).ConfigureAwait(false); // We don't set the token to null, cause we want that the next request (without reauthorizing) will fail). return(true); }
/// <summary> /// Refreshes the token by calling to ActiveUserConfig.GetActiveUserToken /// </summary> public async Task <bool> RefreshTokenAsync(CancellationToken taskCancellationToken) { TokenResponse userToken = await ActiveUserConfig.GetActiveUserToken(taskCancellationToken, refresh : true); if (userToken != null && userToken.AccessToken != null) { return(true); } return(false); }
public virtual async Task <string> GetAccessTokenForRequestAsync(string authUri = null, CancellationToken cancellationToken = default(CancellationToken)) { TokenResponse token = await ActiveUserConfig.GetActiveUserToken(cancellationToken); return(token.AccessToken); }