Skip to content

Instantly share code, notes, and snippets.

@ProgramadorJunior20
Forked from Klerith/parse-jwt.js
Created March 3, 2024 14:19
Show Gist options
  • Save ProgramadorJunior20/db749f886a0977c9eb1ade5bcadf8bd3 to your computer and use it in GitHub Desktop.
Save ProgramadorJunior20/db749f886a0977c9eb1ade5bcadf8bd3 to your computer and use it in GitHub Desktop.
Parse - JWT - Obtener Payload y fecha de creación y expiración
function parseJwt (token) {
var base64Url = token.split('.')[1];
var base64 = base64Url.replace('-', '+').replace('_', '/');
return JSON.parse(window.atob(base64));
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment