TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

How to Store Session Tokens in a Browser (and the Impacts of Each)

4 pointsby pedro84over 4 years ago

1 comment

franky47over 4 years ago
Another interesting approach is the one used in ProtonMail, using the SessionVars trick by Thomas Frank.<p>It combines in-memory storage for XSS safety, and a combination of SessionStorage and `window.name` to split the token into secret random parts, each taking its separate channel, to ensure the token survives a page reload.<p>I wrote about the details on how it works [1] and packed a TypeScript implementation on NPM [2].<p>[1] <a href="https:&#x2F;&#x2F;francoisbest.com&#x2F;posts&#x2F;2019&#x2F;how-to-store-e2ee-keys-in-the-browser" rel="nofollow">https:&#x2F;&#x2F;francoisbest.com&#x2F;posts&#x2F;2019&#x2F;how-to-store-e2ee-keys-i...</a><p>[2] <a href="https:&#x2F;&#x2F;github.com&#x2F;47ng&#x2F;session-keystore" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;47ng&#x2F;session-keystore</a>