Is there any way to logout on browser close while using jwt token in local storage for authentication in MeanStack application.
I have used beforeunload but it is called on refresh and few other events as well.
You could use sessionStorage instead of localStorage. The only difference is that sessionStorage is only meant to survive the current browser session. Another option would be to store your application state in memory (in a variable) and it will be gone on close.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With