Skip to content

Instantly share code, notes, and snippets.

@MeetMartin
Created September 21, 2021 05:57
Show Gist options
  • Save MeetMartin/27a8047e3da661212d492f15379ee9ef to your computer and use it in GitHub Desktop.
Save MeetMartin/27a8047e3da661212d492f15379ee9ef to your computer and use it in GitHub Desktop.
const myJWT = 'eyJhbGciOfJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkaWWiOiJka…afyMH0.WrIEBW5LNLjfGWqIA4XKsyIiuWzbIIpNadfZVkmA6hPs';
// store JWT in session storage
sessionStorage.setItem('JWT', myJWT);
console.log('My JWT is', sessionStorage.getItem('JWT'));
// remove JWT from storage
sessionStorage.removeItem('JWT');
// clear whole storage
sessionStorage.clear();
// localStorage uses the same API
// example: localStorage.setItem('JWT', myJWT);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment