From 4c2a7a10c71145435ab2795f30da45c6555ff657 Mon Sep 17 00:00:00 2001 From: Michael Spalti Date: Thu, 6 Apr 2023 07:33:46 -0700 Subject: [PATCH] updated auth-cookie check --- src/modules/app/browser-init.service.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/modules/app/browser-init.service.ts b/src/modules/app/browser-init.service.ts index c7559363a3..60e6223ebb 100644 --- a/src/modules/app/browser-init.service.ts +++ b/src/modules/app/browser-init.service.ts @@ -139,19 +139,18 @@ export class BrowserInitService extends InitService { } /** - * When authenticated during the external authentication flow invalidate - * the cache so the app is rehydrated with fresh data. + * During the external authentication flow invalidates the SSR transferState + * data in the cache. This allows the app to fetch fresh content. * @private */ private externalAuthCheck() { - this.authenticationReady$().pipe( - switchMap(() => this.authService.isExternalAuthentication().pipe( - filter((externalAuth: boolean) => externalAuth) - )) + this.authService.isExternalAuthentication().pipe( + filter((externalAuth: boolean) => externalAuth) ).subscribe(() => { - this.authService.setExternalAuthStatus(false); + // Clear the transferState data. this.rootDatatService.invalidateRootCache(); + this.authService.setExternalAuthStatus(false); } );