Skip to content

Instantly share code, notes, and snippets.

@sandipchitale
Created August 28, 2018 21:31
Show Gist options
  • Save sandipchitale/58675be947f2cff57339a91a09247697 to your computer and use it in GitHub Desktop.
Save sandipchitale/58675be947f2cff57339a91a09247697 to your computer and use it in GitHub Desktop.
Scan session storage for JWT access tokens
function tryFromStorage() {
chrome.tabs.executeScript(null, {
code: `
(function readFrom(result) {
([window.sessionStorage, window.localStorage]).forEach(function(storage) {
for (let i = 0; i < storage.length; ++i) {
const key = storage.key(i);
if (key.includes('access')) {
result.push(storage.getItem(key));
}
}
});
return result;
})([])
`
//'sessionStorage.getItem(\'infoarchive.iawa.access_token\')'
}, function(accessTokens) {
return accessTokens;
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment