DEV Community

Discussion on: What Happens If Your JWT Is Stolen?

Collapse
 
vicxxx profile image
VicXXX

See I do the same although I use cookies to store as I need to be able to share token on multiple subdomains (don't ask me why just have to). The article is a little bit misleading in terms of what is the impact of someone hijacking your JWT token. Technically if they have compromised your machine they pretty much hold you by the short and curlies and can access far more sensitive data than your JWT token.

Collapse
 
rdegges profile image
Randall Degges

Hey! You might enjoy this talk I've given on the cross-domain stuff: youtube.com/watch?v=pYeekwv3vC4 I cover using cookies with cross-domain and the proper way to do it towards the middle of the talk.

Thread Thread
 
vicxxx profile image
VicXXX

Cheers! I'll have a look.

Thread Thread
 
vicxxx profile image
VicXXX

Hahhaa I like how it's called JSON Web Tokens Suck... I kinda agree :D

Collapse
 
kspeakman profile image
Kasey Speakman

Oh I totally understand needing to be able to share the token across subdomains. It helps with deployment flexibility.

One note of caution though. I realized later that what I described at the end (putting the JWT in a cookie) opens itself up to XSRF attacks unless other precautions are taken. Common ones are anti-forgery tokens (which requires keeping some session state) or using CORS with appropriate Origin restrictions.

Thread Thread
 
vicxxx profile image
VicXXX

Yeah we do that already and actually upgrading platform to stop relying on the client generated cookies and switching to http only