From bb7ec459e8dab3acc9d19398ab0d6d931092e52a Mon Sep 17 00:00:00 2001 From: Urmi Kataria Date: Tue, 12 Mar 2024 13:55:18 -0700 Subject: [PATCH 1/2] fix login in portal --- .../app/services/authentication/authentication.service.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/portal-frontend/src/app/services/authentication/authentication.service.ts b/portal-frontend/src/app/services/authentication/authentication.service.ts index cb5f636e2c..a28edb1dac 100644 --- a/portal-frontend/src/app/services/authentication/authentication.service.ts +++ b/portal-frontend/src/app/services/authentication/authentication.service.ts @@ -79,13 +79,10 @@ export class AuthenticationService { async refreshTokens(redirect = true) { if (this.refreshToken) { - if (this.expires && this.expires < Date.now()) { - if (redirect) { - await this.router.navigateByUrl('/login'); - } + if (this.refreshExpires && this.refreshExpires < Date.now()) { + await this.router.navigateByUrl('/login'); return; } - const newTokens = await this.getNewTokens(this.refreshToken); await this.setTokens(newTokens.token, newTokens.refresh_token); } From 931f0a5fbada26817f053e113c2871a8d0b88525 Mon Sep 17 00:00:00 2001 From: Urmi Kataria Date: Tue, 12 Mar 2024 15:08:27 -0700 Subject: [PATCH 2/2] fix --- .../src/app/services/authentication/authentication.service.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/portal-frontend/src/app/services/authentication/authentication.service.ts b/portal-frontend/src/app/services/authentication/authentication.service.ts index a28edb1dac..8b7c9dc393 100644 --- a/portal-frontend/src/app/services/authentication/authentication.service.ts +++ b/portal-frontend/src/app/services/authentication/authentication.service.ts @@ -80,7 +80,9 @@ export class AuthenticationService { async refreshTokens(redirect = true) { if (this.refreshToken) { if (this.refreshExpires && this.refreshExpires < Date.now()) { - await this.router.navigateByUrl('/login'); + if (redirect) { + await this.router.navigateByUrl('/login'); + } return; } const newTokens = await this.getNewTokens(this.refreshToken);