'chrome: why does localStorage also contains sessionStorage data?
I am using AWS Cognito for my web app and testing with Chrome browser.
I started with the default AWS Cognito / Amplify configurations, such that the tokens are stored in chrome localStorage. When I close browser and re-opens it, I can still login without entering username and password again.
Now I changed AWS Cognito / Amplify configurations to
Auth.configure({ storage: window.sessionStorage })
such that tokens should be stored in chrome sessionStorage
and users automatically log out when closing the tab/browser.
I have confirmed that it works - I see tokens appear in sessionStorage and I indeed have logged out when closing the tab/browser.
However, I still see tokens appear in localStorage, and even though they are in localStorage, they do not survive tab closing:
As you can see in sessionStorage, access/id/refresh tokens are red-lined:
And in localStorage, access/id/refresh tokens are also there:
However, they do not survive tab closing.
Why are they there?
Solution 1:[1]
Seems you forgot to clear site data (Application browser's tab)
Because Auth.configure({ storage:<your_storage> })
sets it up in appropriate storage only
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Turboslav Dulia |