Skip to content

Instantly share code, notes, and snippets.

@programmeruser2
Last active May 31, 2022 09:15
Show Gist options
  • Save programmeruser2/c7f7826717e39adf108e49637eae8522 to your computer and use it in GitHub Desktop.
Save programmeruser2/c7f7826717e39adf108e49637eae8522 to your computer and use it in GitHub Desktop.
Decode JWT
const decodeJwt = token => token.split('.').map((item,index) => index==2?item:JSON.parse(atob(item)));
const encodeJwt = segments => segments.map((item,index)=>index==2?item:btoa(JSON.stringify(item))).join('.');
@programmeruser2
Copy link
Author

programmeruser2 commented Jul 5, 2021

Me

Who are you and what are you trying to do

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment