Created
November 1, 2021 22:05
-
-
Save arturmkrtchyan/453ba30a4d4c13c17fc04610f8a1cac4 to your computer and use it in GitHub Desktop.
Remove Auth Token In 30 mins
This file contains 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
<script> | |
document.addEventListener("DOMContentLoaded", function() { | |
const jwtToken = getCookie('jwtToken'); | |
setCookie('jwtToken', jwtToken, 30); | |
function setCookie(name, value, minutes) { | |
var date = new Date(); | |
date.setTime(date.getTime() + (minutes * 60 * 1000)); | |
var expires = "expires="+ date.toUTCString(); | |
document.cookie = name + "=" + value + ";" + expires + ";path=/;" + "SameSite=None; Secure"; | |
} | |
function getCookie(cookieName) { | |
var name = cookieName + "="; | |
var decodedCookie = decodeURIComponent(document.cookie); | |
var ca = decodedCookie.split(';'); | |
for (var i = 0; i < ca.length; i++) { | |
var c = ca[i]; | |
while (c.charAt(0) == ' ') { | |
c = c.substring(1); | |
} | |
if (c.indexOf(name) == 0) { | |
return c.substring(name.length, c.length); | |
} | |
} | |
return ""; | |
} | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment