Any other important concerns or which way is recommended currently?
Any other important concerns or which way is recommended currently?
You're confusing JWTs (a standardized token / means of representing claims) and JavaScript localStorage (a storage which can be read by scripts, partitioned by origin). The two are completely orthogonal; you could store a JWT in a cookie, if you wanted to.
> JWTs [… make] XSS attacks easier. I also found cookies easier to use, since the browser handles them and you don't need to attach headers to each request.
The browser handling them automatically means you need to think about CSRF, which I think largely negates the benefits.
If your site is vulnerable to XSS, a cookie won't save you; the XSS attacker just makes the necessary authenticated request using an AJAX.
My current favorite writeup on this is https://portswigger.net/blog/web-storage-the-lesser-evil-for...
This article describes some of the most vulnerable ways to use a JWT in 2019, but please let's stop talking about none algorithms.
EDIT: apparently it's a bit more complicated than that: IE11 on windows 7 doesn't support it, and Safari < iOS12 doesn't support it. Still seems like a significant-enough chunk that you can't rely on it.
Huh? If it's an HTTPOnly cookie, how would you then insert the JWT token into the auth header?