5 ms·
> Isn’t session token theft as much of an issue as JWT token theft? Session tokens can be revoked much more easily, say when a user logs out. A JWT token needs
by pcthrowaway 2y ago
> Isn’t session token theft as much of an issue as JWT token theft?
Session tokens can be revoked much more easily, say when a user logs out. A JWT token needs a revokation service to revoke early, and that adds a fair bit of additional complexity.
Also, assuming your client is a web browser (as is often the case) and you're sending the Authorization header, you have to store that JWT somewhere in the browser where it's not isolated from the rest of the scripts on your page (whereas session tokens are typically stored in opaque cookies with a lower chance of leaking to a malicious script).
Though I imagine you can also store JWTs as cookies, which wold mitigate that issue.
- jabart 2y agoI thought the latest recommendation was to use JWTs with a 15 minute expiration. You could also put a JWT in a cookie. Also some implementations of a Session don't use a database lookup and need extra work to invalidate a session. Same lookup can be used on a JWT.
- pcthrowaway 2y agoYeah but then you give them a refresh token which you still have the same problem with. > You could also put a JWT in a cookie. Yep, I mentioned that also