-
-
Save albertoperezf/a3573250ee56a4800a0883d4d22e2c30 to your computer and use it in GitHub Desktop.
Get JWT from cookie
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
let cname = 'jwt' | |
let name = cname + '=' | |
let decodedCookie = decodeURIComponent(document.cookie) | |
let ca = decodedCookie.split(';') | |
for (var i = 0; i < ca.length; i++) { | |
var c = ca[i] | |
if (c.indexOf(name) === 0) { | |
console.log('works') | |
let token = c.substring(name.length, c.length) | |
} else { | |
console.log('Error with the cookie') | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment