From 1c8db3ac9472677d7e52992e785dd562325c9bc3 Mon Sep 17 00:00:00 2001 From: Willem Dantuma Date: Mon, 11 May 2020 20:50:38 +0200 Subject: [PATCH] Add some debug logging --- projects/common/src/fm/services/auth-guard.service.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/projects/common/src/fm/services/auth-guard.service.ts b/projects/common/src/fm/services/auth-guard.service.ts index 2722c0b..9bd84c7 100644 --- a/projects/common/src/fm/services/auth-guard.service.ts +++ b/projects/common/src/fm/services/auth-guard.service.ts @@ -40,19 +40,24 @@ export class AuthGuard implements CanActivate, CanLoad, CanActivateChild { checkLogin(url: string): Promise { return new Promise((resolve) => { if (!this.oauthService.hasValidAccessToken()) { + console.debug("No valid token"); if(this.oauthService.getRefreshToken() != null ) { + console.debug("We have a refresh token"); this.oauthService.refreshToken().then(() => { this.store.dispatch(new appCommonActions.InitUser()); resolve(true); }).catch(() => { - resolve(false); + console.debug("Error refreshing"); this.oauthService.initCodeFlow(url); + resolve(false); }) } else { - resolve(false); + console.debug("No refresh token"); this.oauthService.initCodeFlow(url); + resolve(false); } } else { + console.debug("Valid token init user"); this.store.dispatch(new appCommonActions.InitUser()); return(true); }