β Cloud & DevOpsQuestion 19 of 50
Why is storing auth tokens in localStorage risky?
π Explanation
localStorage is accessible to any JavaScript running on the page, so if an attacker injects malicious code via XSS, they can steal the token; it's also hard to revoke and lacks protections like HttpOnly cookies have. The other options are incorrect because localStorage isn't encrypted, tokens don't auto-delete each session, and tab-syncing isn't the actual security concern here.
Related questions
β PreviousNo login needed