Only allow one active session at a time

Hi all, I am trying to implement a feature after a pay wall that requires user to have only one active session at the same time (if user tries to log in on another device, old device will be logged out) Please help to guide me a way, any idea is appreciated. Thanks!
Solution:
Not sure if it is the best approach but I achieved this by deleting all the session for that user except the newSession in the after hook. @phipham
Jump to solution
3 Replies
Solution
preAGIcoder
preAGIcoder2mo ago
Not sure if it is the best approach but I achieved this by deleting all the session for that user except the newSession in the after hook. @phipham
preAGIcoder
preAGIcoder2mo ago
there is also authClient.revokeOtherSessions() which you can run as soon as the user signin but it was not working for me so i did it this way
phipham
phiphamOP2mo ago
Thanks for your answer! I will definitely have a try 🙏

Did you find this page helpful?