cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

Quick-add: + add another resource

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              var token = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImpheXNhbHZhdCIsInVzZXJfaWQiOjEsImVtYWlsIjoiamF5QGpheXNhbHZhdC5jb20iLCJleHAiOjE0NzQ5NzI2NDZ9.iaeHtflyS3MIN8zF6Y4AgKxcwc4I2QwRClAoonASMB4';

function decodeJwtToken(token) {
    var splits = token.split('.'),
        now = new Date().getTime() / 1000,
        base64,
        payload,
        json;
    
    if (splits.length !== 3) {
        throw new Error('Bad token');
    }
    
    base64 = splits[1];
    payload = atob(base64);

    if (!payload) {
        throw new Error('Bad token');
    }
    
    json = JSON.parse(payload);

    if (!json || !json.exp) {
        throw new Error('Bad token');
    }
    
    console.log(new Date(json.exp * 1000));
    console.log(new Date(now * 1000));
    
    if (json.exp < now) {
        throw new Error('Jwt Token expired');
    }
    return json;
}

var decoded = decodeJwtToken(token);
console.log(decoded);
            
          
!
999px
Loading ..................

Console