Problem statement:-
Force expire a JWT when the user wants to log out from the mobile.
Issue:-
As JWT is not stored on any DB (as doing that will defeat the whole purpose of JWT) what is the correct way to force expire the JWT token?
As I read through various answer I realized that JWT cannot be expired manually (which is what I want to achieve)
As per JWT, it will expire only when it hits the expiration time which is set in the token. This is bad according to security.
Options
Clear the cache and JWT from the mobile app when the user hits logout. But the problem still lies that the JWT is still valid.
Maintain a list of blacklisted JWT when the user hits the logout and compare that to every request after the same. This defeats the whole purpose of JWT. This approach is not scalable and a bad implementation.
I am not sure what is the correct way.