Skip to content

Instantly share code, notes, and snippets.

@pirafrank
Created May 25, 2020 09:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pirafrank/3b34ca10452e794b068a1dbd5e30d9f5 to your computer and use it in GitHub Desktop.
Save pirafrank/3b34ca10452e794b068a1dbd5e30d9f5 to your computer and use it in GitHub Desktop.
extract jwt body with no validation
# sometimes you only need to get JWT body data without validating it
# WARNING: use this only if you have already validated the token in earlier steps in the chain
const jwt = "eyJ0eX...";
const jwtBodyJson = JSON.parse(Buffer.from(jwt.split(".")[1], "base64").toString());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment