News for hackers. Stuff that matters.
Re:Why to not use JWT (2021) by 9dev on Thursday September 29, 2022 @11:11AM (#33021809)
I think the easiest explanation is this:

Session IDs are bound to cookies from a given origin. Thus, every request needs to include the original cookie, and have the same origin, to transport authentication data. But cookies cannot be accessed from JavaScript, only be sent implicitly if these things are true.

This made it difficult to work with separate hosts (www.my.app vs. api.my.app).

In contrast, Bearer tokens are explicit: JavaScript code can use and attach them to requests as appropriate, thus allowing for more control. The also are a little easier to work with (no reason to keep a cookie jar, stateless stuff works).

JWTs in turn aren't simply random strings anymore -- they contain some claims about the bearer, which are cryptographically signed, so whoever receives the token can be sure the claims haven't been tampered with. This allows for very powerful, interconnected services -- but most people use them to pass a session ID around, so... here we are :)

Re:Why to not use JWT (2021) by qabqabaca on Thursday September 29, 2022 @11:23AM (#33021967)
> This made it difficult to work with separate hosts (www.my.app vs. api.my.app).

This is still possible with session cookies if you use wildcard origin cookies i.e. *.my.app

Re:Why to not use JWT (2021) by 9dev on Thursday September 29, 2022 @11:57AM (#33022486)
I know, contrived example. Think of www.google.com and googleapis.com. Or CORS issues. There are legitimate problems with cross-origin requests.
Re:Why to not use JWT (2021) by 0x457 on Thursday September 29, 2022 @03:59PM (#33026259)
Yeah, those are issues at google's scale. Almost no one who uses them is even at half of google scale.