sessions
sessions copied to clipboard
How to delete session when the browser closed
use cookie-based
I want to delete session when the browser closed
Did you finally find a solution?
I have forgotten, reviewed the code, the backend is written like this:
store := cookie.NewStore([]byte(config.keyPairs))
store.Options(sessions.Options{
MaxAge:0, // seems this works
Path: "/",
})
It seems to be processed in the frontend, when the browser is closed, delete the browser's cookie.
If you find a solution, remember to tell me, thanks!
Maybe store the cookie on the client? Browsers session storage is cleared whenever user closes the tab
https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage
Does anyone has update? We also encounter such problem and no perfect solution till now