Created
October 18, 2017 17:41
-
-
Save jmarmolejos/7c64a5b55f7945c7fd48c5c08873ed15 to your computer and use it in GitHub Desktop.
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
function parseJwt (token) { | |
var payload = token.split('.')[1]; | |
var base64 = payoad.replace('-', '+').replace('_', '/'); | |
return JSON.parse(window.atob(base64)); | |
}; | |
console.log(parseJwt('jwt_token')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Can you explain why line 3 is required?