News for hackers. Stuff that matters.
Re:JWT should not be your default for sessions by LimaBearz on Thursday May 13, 2021 @01:18AM (#27138677)
Too funny I haven’t been doing front end for very long, maybe a few years..

I knew of the existence of JWT so that’s what I ended up rolling with on my first true frontend heavy project. JWT token tutorials are an excellent example of my theory that “the internet doesn’t know shit, don’t trust it”. Case in point google “JWT ReactJS”. 8/10 tutorials are storing them in localstorage. At the time I knew literally nothing but I knew that was dumb as hell

Re:JWT should not be your default for sessions by jeswin on Thursday May 13, 2021 @01:39AM (#27138807)
> At the time I knew literally nothing but I knew that was dumb as hell

Why? If you're worried about XSS, remember you're already toast in a million ways - including the ability to spoof a login/password form.

Re:JWT should not be your default for sessions by gravlaks on Thursday May 13, 2021 @03:30AM (#27139379)
One reason is if you store refreshTokens in localStorage, a hacker's XSS attack can send the refreshToken to himself, and keep refresing the token forever (or until somebody actively invalidates the session) - and thus use the token for whatever evil purpose.
Re:JWT should not be your default for sessions by totony on Thursday May 13, 2021 @08:56AM (#27141541)
Can't you just read document.cookies to get the token at that point?
Re:JWT should not be your default for sessions by nerdkid93 on Thursday May 13, 2021 @09:32AM (#27141863)
I believe refresh tokens are supposed to be HTTP Only