Change from blacklisting tokens to whitelisting them #277
Replies: 2 comments 1 reply
-
My IMHO is: this does not belong into this library. Reasons:
The correct solution is to have short lived JWT and build that logic into your refresh flow whether you want to re-issue a token for a user or not. |
Beta Was this translation helpful? Give feedback.
-
I'm sorry, but this is a terrible idea for so many reasons. I also don't really get why you have so many blacklisted tokens, perhaps that's a problem with your application/session design, you can explain your auth architecture and gets ideas - I think that would be a better approach. Most applications, especially large scale, will have far more active tokens than blacklisted ones, there's obvious problems of scale storing so many JWTs, and the risks of losing such volatile storage (which is typically redis or equivalent, which is not 100% reliable). |
Beta Was this translation helpful? Give feedback.
-
I propose switching from a blacklist approach to a whitelist approach for token management.
Instead of storing a large list of invalidated tokens, it will only keep track of valid tokens in a whitelist, removing them upon logout or revocation.
This significantly improves performance and resource usage, as the whitelist remains relatively small.
It also offers more control and transparency: any token not on the whitelist is automatically invalid, simplifying checks for token validity and ensuring clean, efficient handling of active sessions.
Beta Was this translation helpful? Give feedback.
All reactions