From 349b3c197dff91d420d626282018a64a810fac94 Mon Sep 17 00:00:00 2001 From: Ehsan Rezaei Date: Tue, 15 Oct 2024 13:42:02 +0200 Subject: [PATCH] Trying to fix JWT token issue --- lib/core/src/lib/auth/oidc/auth.module.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/core/src/lib/auth/oidc/auth.module.ts b/lib/core/src/lib/auth/oidc/auth.module.ts index fe7aecf50c..34c3f1e475 100644 --- a/lib/core/src/lib/auth/oidc/auth.module.ts +++ b/lib/core/src/lib/auth/oidc/auth.module.ts @@ -26,7 +26,10 @@ import { RedirectAuthService } from './redirect-auth.service'; import { AuthenticationConfirmationComponent } from './view/authentication-confirmation/authentication-confirmation.component'; import { StorageService } from '../../common/services/storage.service'; -export const JWT_STORAGE_SERVICE = new InjectionToken('JWT_STORAGE_SERVICE'); +export const JWT_STORAGE_SERVICE = new InjectionToken('JWT_STORAGE_SERVICE', { + providedIn: 'root', + factory: () => inject(StorageService) +}); /** * Create a Login Factory function @@ -42,7 +45,7 @@ export function loginFactory(redirectService: RedirectAuthService): () => Promis * @returns current instance of OAuthStorage */ export function oauthStorageFactory(): OAuthStorage { - return inject(JWT_STORAGE_SERVICE) ?? inject(StorageService); + return inject(JWT_STORAGE_SERVICE); } @NgModule({