If You Can't Control the Storage, Control the Access | HackerNoon
Briefly

The solution involves issuing JWT tokens with hashed fingerprints of user agent and IP address. This mitigates the risk of XSS attacks when tokens are used from local storage.
Many developers mistakenly store JWTs in local storage, which is vulnerable to XSS attacks. To enhance security, we can modify how we issue the tokens instead.
By using a hashed fingerprint in the JWT, even if an attacker accesses the token, they won't be able to retrieve user information, which adds an additional security layer.
This approach emphasizes the need for adaptation in the face of security limitations imposed by certain frontend storage methods—demonstrating that innovation often arises from constraints.
Read at Hackernoon
[
|
]