Created
November 21, 2024 00:36
-
-
Save KazChe/f90a063508af48e7b99e813a4ad10cda to your computer and use it in GitHub Desktop.
Runs in Chrome devtools console. Reads Session storage by key and periodically collects/prints SSO log data. Useful for troubleshooting access and refresh tokens.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function pollSSOLogs() { | |
const sessionKey = '<ADD_KEY_HERE>'; | |
const interval = 1 * 60 * 1000; // adjust - set to 1 minute | |
let intervalId; | |
function readSSOLogs() { | |
try { | |
const data = sessionStorage.getItem(sessionKey); | |
if (data) { | |
console.log(`[${new Date().toISOString()}] SSO Logs:`); | |
console.log(data); | |
} else { | |
console.warn(`[${new Date().toISOString()}] No data found under the key: ${sessionKey}`); | |
} | |
} catch (error) { | |
console.error(`[${new Date().toISOString()}] Error reading SSO logs:`, error); | |
} | |
} | |
readSSOLogs(); | |
intervalId = setInterval(readSSOLogs, interval); | |
window.clearSSOInterval = function () { | |
if (intervalId) { | |
clearInterval(intervalId); | |
intervalId = null; // ensure it cannot be cleared multiple times | |
console.log('SSO polling interval cleared. No further logs will be collected.'); | |
} else { | |
console.warn('No active interval found to clear.'); | |
} | |
}; | |
console.log('SSO polling started. Use `clearSSOInterval()` to stop.'); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment