Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Multiple sessions #1517

Closed
Munadil16 opened this issue Oct 27, 2024 · 4 comments
Closed

bug: Multiple sessions #1517

Munadil16 opened this issue Oct 27, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@Munadil16
Copy link
Contributor

Describe the bug
I am able to login in 3-4 devices, and I'm not logged out for accessing content from more than 1 device/browser.

To Reproduce
Steps to reproduce the behavior:

  1. Try logging in from 2 or more devices, you won't be logged out

Expected behavior
Earlier this wasn't the case, I was logged out from previous device/browser, if I access from more than 1 device/browser

@Munadil16 Munadil16 added the bug Something isn't working label Oct 27, 2024
@IkramBagban
Copy link
Contributor

@devsargam please assign this to me.

@devsargam
Copy link
Collaborator

@IkramBagban how are you thinking of solving this?

@IkramBagban
Copy link
Contributor

@IkramBagban how are you thinking of solving this?

I am thinking to generate a unique JWT token on every login and store it in user's table. and validate the token on every request. and if the new login occurs then will replace the previous stored token with new token. this will solve the problem.

Btw what do you think? Should I store the token in the database, or should I use Redis to store the token since it would be faster?

@IkramBagban
Copy link
Contributor

@devsargam done. Please check the pr #1520

devsargam added a commit that referenced this issue Dec 6, 2024
* fix:  Enforce single-session login by invalidating previous JWTs on new login #1517

* Update src/middleware.ts

---------

Co-authored-by: Sargam <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants