Best way to store token information in Angular JS

75 views Asked by At

I am pretty confused with storing token information. Currently I am storing token information in Localstorage but the information remain even after closing the tab. Only during logout I am able to clear the token information from localstorage. But I want the token information to get cleared when following happened:-

  • User accidentally close the browser(not tab)
  • Browser crashed
  • Browser closed from task manager

I know that SessionStorage will be useful in such scenarios but Sessionstorage cannot be shared between tabs. If it can be shared then can please put the working example?

0

There are 0 answers