User is able to login to application using the msal npm package and perform operations. Login and logout etc working fine. but if user close the browser tab and again open it still user is logged in.
Is there any method for this or have to add custom event to capture onunload and then clear the localStorage ?
You shouldn't be using localStorage if you want this sort of functionality. Passing the value 'sessionStorage' as the cacheLocation parameter when instantiating the UserAgentApplication will get you closer to what you want. The documentation on these parameters can be found in the wiki.
You shouldn't be using localStorage if you want this sort of functionality. Passing the value 'sessionStorage' as the
cacheLocationparameter when instantiating theUserAgentApplicationwill get you closer to what you want. The documentation on these parameters can be found in the wiki.
sessionStorage will store the session only for the tab where user is logged in and if the user open application in another tab or click any link in app to open in new tab he have to login again as sessionStorage is tabs specific. So what to do in such case
@AbhaysinghBhosale What you seem to require us to clear 'localStorage' on exit which is beyond the functionality of this library. You may be able to clear the 'localStorage' on the exit of the window from the application end.
Closing this issue.
Most helpful comment
You shouldn't be using localStorage if you want this sort of functionality. Passing the value 'sessionStorage' as the
cacheLocationparameter when instantiating theUserAgentApplicationwill get you closer to what you want. The documentation on these parameters can be found in the wiki.