Closed
Description
If an exception is caught during "RefreshTokenAsync", the token file is deleted! This will force unneeded re-authorization on the client. In my case, the client is actually a long-running windows service so this disrupts this process and requires a human re-connect it.
Is there a reason that this is done?
` ///
/// User identifier.
/// Token request.
/// Cancellation token to cancel operation.
/// Token response with the new access token.
[VisibleForTestOnly]
public async Task FetchTokenAsync(string userId, TokenRequest request,
CancellationToken taskCancellationToken)
{
// Add client id and client secret to requests.
request.ClientId = ClientSecrets.ClientId;
request.ClientSecret = ClientSecrets.ClientSecret;
TokenResponseException tokenException = null;
try
{
var tokenResponse = await request.ExecuteAsync
(httpClient, TokenServerUrl, taskCancellationToken, Clock).ConfigureAwait(false);
return tokenResponse;
}
catch (TokenResponseException ex)
{
// In case there is an exception during getting the token, we delete any user's token information from
// the data store.
tokenException = ex;
}
await DeleteTokenAsync(userId, taskCancellationToken).ConfigureAwait(false);
throw tokenException;
}`
Metadata
Metadata
Assignees
Labels
No labels