Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

decode jwt token without library

let b64DecodeUnicode = str =>
  decodeURIComponent(
    Array.prototype.map.call(atob(str), c =>
      '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2)
    ).join(''))

let parseJwt = token =>
  JSON.parse(
    b64DecodeUnicode(
      token.split('.')[1].replace('-', '+').replace('_', '/')
    )
  )
Comment

PREVIOUS NEXT
Code Example
Javascript :: case switch javascript 
Javascript :: routes in angular 
Javascript :: make forn awesome icon clickable in react 
Javascript :: jquery document ready deprecated 
Javascript :: concat no and string in javascript 
Javascript :: convert text to qr code in angular 
Javascript :: add mongodb compass to js 
Javascript :: how to compare two strings in javascript if condition 
Javascript :: check property exists in object javascript 
Javascript :: create record mongoose model 
Javascript :: how to disable button if errors object isnt empty in react hook form 
Javascript :: Vowel Count 
Javascript :: two days before in moment 
Javascript :: react hook state not updating immediately 
Javascript :: map and filter js 
Javascript :: how javascript run in browser 
Javascript :: Working of JavaScript Arrays 
Javascript :: javascript reduce method stack overflow 
Javascript :: object destructuring example 
Javascript :: constructor js 
Javascript :: js csv to json 
Javascript :: Progress bar loader angular 
Javascript :: react redux form validation 
Javascript :: reverse string 
Javascript :: create random password 
Javascript :: javascript get object value dynamically 
Javascript :: javascript even number 
Javascript :: max value in an array 
Javascript :: how to use the foreach fnction javascript loop through array 
Javascript :: data types in js 
ADD CONTENT
Topic
Content
Source link
Name
2+1 =