Re:JWTs suck (for web auth and basically everything else)
by rdegges on Thursday August 22, 2019 @04:06PM
(#20771884)
I'm the original author. There are several reasons:
- The cookie payload if you're using stateless JWTs will often be > 4kb, meaning you can't store the JWT in a cookie. - You get no benefit from doing it this way since it is more complex to use JWTs than plain old session cookies. - You will still need centralization regardless if you want to support token revocation.
Re:JWTs suck (for web auth and basically everything else)
by ehutch79 on Thursday August 22, 2019 @03:45PM
(#20771689)
To be fair, 90% of the time i see people recommend JWT for auth, it's a session token inside a jwt in a cookie, which then gets decoded and checked against the db in the backend
Re:JWTs suck (for web auth and basically everything else)
by frankpf on Thursday August 22, 2019 @07:08PM
(#20773203)
Using a cookie is not a benefit, it's a downside. You have to deal with CSRFs, which aren't possible with localStorage.
Re:JWTs suck (for web auth and basically everything else)
by rdegges on Thursday August 22, 2019 @07:51PM
(#20773447)
But then you open yourself up to XSS which is a lot harder to defend against.
Re:JWTs suck (for web auth and basically everything else)
by frankpf on Thursday August 22, 2019 @07:56PM
(#20773475)
You don't open yourself up to XSS, see my comment above: https://news.ycombinator.com/item?id=20773188
Benefit: retain horizontal scaling capabilities, don't have to use local storage.