Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

Fix auth revoke token call (#74)

Leendert de Borst158a526aee70
diff --git a/src/AliasVault.WebApp/Main/Pages/Sync/StatusMessages/Creating.razor b/src/AliasVault.WebApp/Main/Pages/Sync/StatusMessages/Creating.razor
index 7c295c955..29e195731 100644
--- a/src/AliasVault.WebApp/Main/Pages/Sync/StatusMessages/Creating.razor
+++ b/src/AliasVault.WebApp/Main/Pages/Sync/StatusMessages/Creating.razor
@@ -3,11 +3,11 @@
<div class="relative p-8 bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-md mx-auto">
<div class="text-center">
- <svg class="mx-auto animate-spin h-12 w-12 text-primary-500" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
- <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
- <path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
- </svg>
<div class="space-y-4">
+ <svg class="mx-auto animate-spin h-12 w-12 text-primary-500" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
+ <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
+ <path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
+ </svg>
<h2 class="text-xl font-semibold text-gray-900 dark:text-white">Welcome to AliasVault!</h2>
<p class="text-sm text-gray-500 dark:text-gray-400">
Your new encrypted vault is being created. This process may take a moment. Please wait.
diff --git a/src/AliasVault.WebApp/Services/Auth/AuthService.cs b/src/AliasVault.WebApp/Services/Auth/AuthService.cs
index c31061ede..d0dae03ef 100644
--- a/src/AliasVault.WebApp/Services/Auth/AuthService.cs
+++ b/src/AliasVault.WebApp/Services/Auth/AuthService.cs
@@ -163,19 +163,19 @@ public class AuthService(HttpClient httpClient, ILocalStorageService localStorag
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
public async Task RemoveTokensAsync()
{
- await localStorage.RemoveItemAsync(AccessTokenKey);
- await localStorage.RemoveItemAsync(RefreshTokenKey);
-
- // If the remote call fails we catch the exception and ignore it.
- // This is because the user is already logged out and we don't want to trigger another refresh token request.
+ // Revoke the tokens from the server by calling the webapi.
try
{
await RevokeTokenAsync();
}
catch (Exception)
{
- // Ignore the exception
+ // If an exception occurs we ignore it and continue with removing the tokens from local storage.
}
+
+ // Remove the tokens from local storage.
+ await localStorage.RemoveItemAsync(AccessTokenKey);
+ await localStorage.RemoveItemAsync(RefreshTokenKey);
}
/// <summary>