From 388e65a2e5964fbe6b5f90f86f1eea362c9c4ad0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jovan=20Kruni=C4=87?= Date: Tue, 13 Oct 2026 15:18:02 +0200 Subject: [PATCH] WIP sign in failed --- .../app/modules/auth/auth.provider.spec.ts | 20 +++++++++++++++++++ .../app/src/app/modules/auth/auth.provider.ts | 1 - 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/frontend/app/src/app/modules/auth/auth.provider.spec.ts b/frontend/app/src/app/modules/auth/auth.provider.spec.ts index 49a691fb..bfea20cf 100644 --- a/frontend/app/src/app/modules/auth/auth.provider.spec.ts +++ b/frontend/app/src/app/modules/auth/auth.provider.spec.ts @@ -440,6 +440,26 @@ describe('AuthProvider', () => { }); }); + describe('failed sign-in', () => { + it('keeps an existing session', async () => { + await givenLoadedToken(makeToken({accessToken: 'still-valid'})); + + internals.notify({action: AuthActions.SignInFailed, error: new Error('state mismatch')}); + + expect(await isLoggedIn()).toBeTrue(); + expect(internals.tokenSubject.value?.accessToken).toBe('still-valid'); + expect(storageRemoveItem).not.toHaveBeenCalled(); + }); + + it('stays logged out without a session', async () => { + await givenLoadedToken(null); + + internals.notify({action: AuthActions.SignInFailed, error: new Error('access_denied')}); + + expect(await isLoggedIn()).toBeFalse(); + }); + }); + describe('signOut', () => { /** The [token, token_type_hint, client_id] of each revoke request, in order. */ const revokedTokens = () => diff --git a/frontend/app/src/app/modules/auth/auth.provider.ts b/frontend/app/src/app/modules/auth/auth.provider.ts index e91b3b68..bf64ebb9 100644 --- a/frontend/app/src/app/modules/auth/auth.provider.ts +++ b/frontend/app/src/app/modules/auth/auth.provider.ts @@ -1304,7 +1304,6 @@ export class AuthProvider { action: IAuthAction, ): void { switch (action.action) { - case AuthActions.SignInFailed: case AuthActions.SignOutSuccess: case AuthActions.SignOutFailed: case AuthActions.SessionExpired: {