From c2b76889464810c7bf91c8b52484f9c2553aea6e Mon Sep 17 00:00:00 2001 From: Anton SHEPILOV Date: Thu, 30 May 2024 17:39:42 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9BFixed=20redirect=20to=20the=20sign-?= =?UTF-8?q?up=20page=20after=20unsuccessful=20internal=20token=20initializ?= =?UTF-8?q?ation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../auth/provider/oidc/oidc-auth-provider-service.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tdrive/frontend/src/app/features/auth/provider/oidc/oidc-auth-provider-service.ts b/tdrive/frontend/src/app/features/auth/provider/oidc/oidc-auth-provider-service.ts index 6cbbc437..3844ac35 100644 --- a/tdrive/frontend/src/app/features/auth/provider/oidc/oidc-auth-provider-service.ts +++ b/tdrive/frontend/src/app/features/auth/provider/oidc/oidc-auth-provider-service.ts @@ -120,13 +120,19 @@ export default class OIDCAuthProviderService this.initialized = true; } this.logger.info('Setting new access token'); - await this.params?.onNewToken(jwt); + this.params?.onNewToken(jwt); } catch (err) { this.logger.error( 'OIDC user loaded listener, error while getting the JWT from OIDC token', err, ); - throw Error('Error while getting the JWT from OIDC token'); + //if we can't retrieve the internal token with the current oidc token + // for example in case of its expiration or SLO + //just reinitialize OIDC flow in this case + await this.userManager?.removeUser(); + await this.signinRedirect(); + //and throw error to cancel post-login callbacks + // throw Error('Error while getting the JWT from OIDC token'); } } else { await this.signinRedirect();