Skip to content

v1.4.0

Compare
Choose a tag to compare
@tsndr tsndr released this 04 Jun 15:38
· 160 commits to main since this release
f846695

Breaking Changes

.decode() will now return header and payload.

TL;DR

Change this...

const payload = jwt.decode(token)

...to this...

const { payload } = jwt.decode(token)

Old behavior

.decode() just returned an object containing the payload:

{
    name: 'John Doe',
    email: 'john.doe@gmail.com'
}

New behavior

.decode() now returns and object containing header and payload:

{
    header: {
        alg: 'HS256',
        typ: 'JWT'
    },
    payload: {
        name: 'John Doe',
        email: 'john.doe@gmail.com'
    }
}