From 7d0ab292b989a780ddda39fb1d17917e32968581 Mon Sep 17 00:00:00 2001 From: Brijesh Patel Date: Mon, 3 Oct 2022 11:54:11 +0530 Subject: [PATCH 1/4] Add logs to investigate user logout issue --- .../pages/manage-delegated/service/manage-delegate.service.ts | 1 + src/app/services/auth/auth.service.ts | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/app/pages/manage-delegated/service/manage-delegate.service.ts b/src/app/pages/manage-delegated/service/manage-delegate.service.ts index 3c7ed0ff8..fd4225215 100644 --- a/src/app/pages/manage-delegated/service/manage-delegate.service.ts +++ b/src/app/pages/manage-delegated/service/manage-delegate.service.ts @@ -73,6 +73,7 @@ export class ManageDelegateService { localStorage.setItem('permission_organisation_id',this.getDelegatedOrg); } setTimeout(() => { + console.log('Angular - Navigate to Home'); this.route.navigateByUrl('/home'); }, 100); }) diff --git a/src/app/services/auth/auth.service.ts b/src/app/services/auth/auth.service.ts index 3102731b9..4c33154df 100644 --- a/src/app/services/auth/auth.service.ts +++ b/src/app/services/auth/auth.service.ts @@ -80,6 +80,7 @@ export class AuthService { renewAccessToken(url: string = '') { let data: any data = this.getRefreshToken().toPromise().then((refreshToken: any) => { + console.log('Angular - Core Refresh Token Call'); return this.renewToken(refreshToken || '').toPromise().then((tokenInfo: TokenInfo) => { this.workerService.storeTokenInWorker(tokenInfo); return this.createSession(tokenInfo.refresh_token).toPromise().then(() => { @@ -319,4 +320,4 @@ export class AuthService { }) ); } -} \ No newline at end of file +} From 4bb312fbfd3d532160368873ca74e128ed903e1f Mon Sep 17 00:00:00 2001 From: Brijesh Patel Date: Mon, 3 Oct 2022 12:09:33 +0530 Subject: [PATCH 2/4] Add logs to investigate user logout issue --- src/app/pages/home/home.component.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/app/pages/home/home.component.ts b/src/app/pages/home/home.component.ts index 96aca7572..a94f439d5 100644 --- a/src/app/pages/home/home.component.ts +++ b/src/app/pages/home/home.component.ts @@ -65,6 +65,7 @@ export class HomeComponent extends BaseComponent implements OnInit { } ngOnInit() { + console.log('Angular - Call for permission'); this.authService.getPermissions('HOME').toPromise().then((response) => { this.servicePermissions = response; this.authService.getCcsServices().toPromise().then((data: any) => { From 212b4cddf06a18e4730edb3e2433fcd24871a3ce Mon Sep 17 00:00:00 2001 From: Brijesh Patel Date: Mon, 3 Oct 2022 12:50:52 +0530 Subject: [PATCH 3/4] Add logs to investigate user logout issue --- src/app/interceptors/http-jtw-auth.interceptor.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/app/interceptors/http-jtw-auth.interceptor.ts b/src/app/interceptors/http-jtw-auth.interceptor.ts index 3e45bdb4f..730e97f78 100644 --- a/src/app/interceptors/http-jtw-auth.interceptor.ts +++ b/src/app/interceptors/http-jtw-auth.interceptor.ts @@ -36,6 +36,10 @@ export class HttpJwtAuthInterceptor implements HttpInterceptor { request = request.clone({ headers: request.headers.delete('Content-Type') }); } var cookie = this.getXsrfCookie(); + var isPermissionCall = request.url.indexOf('permissions'); + if(isPermissionCall > 0){ + console.log('Angular - Cookie', cookie); + } if (cookie != '' && cookie != undefined) { request = request.clone({ headers: request.headers.set('X-XSRF-TOKEN', cookie) }); } From 64d6e04d561ace1be9d4b3b4171322afdd4671cb Mon Sep 17 00:00:00 2001 From: Brijesh Patel Date: Mon, 3 Oct 2022 16:30:48 +0530 Subject: [PATCH 4/4] Change to fix user logout issue --- .../service/manage-delegate.service.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/app/pages/manage-delegated/service/manage-delegate.service.ts b/src/app/pages/manage-delegated/service/manage-delegate.service.ts index fd4225215..de8e285fd 100644 --- a/src/app/pages/manage-delegated/service/manage-delegate.service.ts +++ b/src/app/pages/manage-delegated/service/manage-delegate.service.ts @@ -56,7 +56,7 @@ export class ManageDelegateService { public setDelegatedOrg(org: any): void { localStorage.setItem('delegatedOrg', org); this.delegatedOrg.next(org) - this.AuthService.renewAccessToken() + this.AuthService.renewAccessToken('/home') this.setPermissionOrgDetails() } @@ -72,10 +72,10 @@ export class ManageDelegateService { }else{ localStorage.setItem('permission_organisation_id',this.getDelegatedOrg); } - setTimeout(() => { - console.log('Angular - Navigate to Home'); - this.route.navigateByUrl('/home'); - }, 100); + // setTimeout(() => { + // console.log('Angular - Navigate to Home'); + // this.route.navigateByUrl('/home'); + // }, 100); }) }