We have SPA and using refreshToken via Cognito is really problematic as there is no way to check if refreshToken is expired and that probably leads to problem. We logout user when we assume that refreshToken is expired, but that doesn't work when user closed the page and Cognito has session saved in Local Storage.
That leads to uncatched ERROR and then flow is:
Click login button
Get error in console
ERROR TypeError: Cannot read property 'getTokenScopes' of null
at CognitoAuth.getSpaceSeperatedScopeString (CognitoAuth.js:740)
at CognitoAuth.getFQDNSignIn (CognitoAuth.js:757)
at Object.onFailure (auth.effect.ts:127)
at CognitoAuth.onFailure (CognitoAuth.js:663)
at XMLHttpRequest.addressState [as __zone_symbol__ON_PROPERTYreadystatechange] (CognitoAuth.js:624)
at XMLHttpRequest.wrapFn (zone.js:1188)
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:421)
at Object.onInvokeTask (core.js:4053)
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:420)
at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:188)
We have SPA and using refreshToken via Cognito is really problematic as there is no way to check if refreshToken is expired and that probably leads to problem. We logout user when we assume that refreshToken is expired, but that doesn't work when user closed the page and Cognito has session saved in Local Storage.
That leads to uncatched ERROR and then flow is: