Want to learn more about OAuth 2.0 and OpenID Connect?
Save yourself days of digging through dozens of specs with this online courseMore information
Token security in Single Page Applications
This page contains the resources for the talk titled 'Token security in Single Page Applications'.
Can a single page application store tokens in localStorage?
Yes, of course! LocalStorage is persistent storage, so the token is available to all tabs and windows. It even survives a browser restart.
No, absolutely not! LocalStorage is insecure, and an attacker will be able to steal the token.
Believe it or not, but both answers are correct. As simple as this question is, the answer is far from straightforward. In this session, we dive into the security properties of SPAs. We investigate why localStorage is insecure and discuss potential alternatives. By the end of this session, you will be able to decide where to store tokens in your applications. Even better, you’ll be able to argue why your decision is the right one.
Dr. Philippe De Ryck
Hi, I'm Philippe, and I help developers protect companies through better web security. As the founder of Pragmatic Web Security, I travel the world to teach practitioners the ins and outs of building secure software.
Talks and workshops
Security is often about small nuances. In my articles, I dive deeper into various security topics, providing concrete guidelines and advice. My articles also answer questions I often get while speaking or teaching.
Getting security right is all about knowledge. I strongly believe in sharing that knowledge to move forward as a community. Among my resources, you can find developer cheat sheets, recorded talks, and extensive slide decks.
Subscribe to the Pragmatic Web Security mailing list to stay up to date on the latest activities and resources.