Skip to content

How to logout/invalidate a session in a different browser? #12620

Answered by mkurz
davidmr asked this question in Q&A
Discussion options

You must be logged in to vote

This is not a Play specific problem. You would have implement a mechasim that tracks all user's session (e.g. based on browser and ip) and then when a user sends a log out request invalidate all of his/her other sessions.

Just an idea:
When a user logs in the first time you could save the current timestamp in it's session cookie.
You need to store this current timestamp also in a map or in key/value store or database, etc if they key does not exists yet.
On each request you read this timestampe session value and it has to <= with your saved value otherwise user is logged out.
So when a user logs out you delete the saved timestamp by your app (remove it from the map, etc), which invalidate…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@davidmr
Comment options

Answer selected by davidmr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants