@rackspace-identity-platform/cookie-monster
v0.5.0
Published
Tools for managing browser sessions for individual tabs
Downloads
2
Readme
Cookie Monster
Cookie Monster is a set of tools to manage tab-based session cookies.
The process for tab-based sessions is to use browser cookies for transport rather than an data storage. CookieMonster provides two tools help make this happen, a script and a page template. The script will hook into all server-communication methods in the browser to create this affect. The page template is designed as a customizable HTML page to serve in case the server endpoint receives an webpage GET request with no session cookie. It checks for a session and resends the request or forwards the browser to a provided auth url.
Implementation Prerequisites
- The CookieMonster script must be loaded (synchronously) after polyfills but before any code that might wrap fetch/XHR (if those features are used).
- Session cookies must have "httpOnly" turned off.
Usage
Add CookieMonster to your project:
Using npm:
npm install --save @rackspace-identity-platform/cookie-monster
Or yarn:
yarn add @rackspace-identity-platform/cookie-monster
See each feature's documentation linked below.
TODO
- Consider timeouts on
sessionStorage
values. - Add semaphors to mitigate race conditions that may happen when more than one tab sends requests to the server at a time.