Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix logout not working properly #36

Merged
merged 1 commit into from
Jan 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions src/iRLeagueManager.Web/Data/AsyncTokenStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public async Task ClearTokensAsync()
logger.LogDebug("Clear token in local browser store");
IsLoggedIn = false;
inMemoryIdToken = string.Empty;
inMemoryAccessToken = string.Empty;
await localStore.DeleteAsync(tokenKey);
await Task.FromResult(true);
if (inMemoryIdToken != tokenValue)
Expand All @@ -53,11 +54,6 @@ public async Task<string> GetIdTokenAsync()
logger.LogDebug("Reading token from local browser store");
try
{
//if (contextAccessor.HttpContext?.Session.IsAvailable == true)
//{
// string token = contextAccessor.HttpContext?.Session.GetString(tokenKey) ?? string.Empty;
// return await Task.FromResult(token);
//}
var token = await localStore.GetAsync<string>(tokenKey);
if (token.Success)
{
Expand Down Expand Up @@ -86,9 +82,9 @@ public async Task<string> GetIdTokenAsync()
IsLoggedIn = false;
return string.Empty;
}
catch (Exception ex)
catch (InvalidOperationException ex)
{
logger.LogError("Could not read from local browser session: {Exception}", ex);
logger.LogWarning("Could not read from local browser session: {Exception}", ex);
return string.Empty;
}
}
Expand Down