1
0

Merge pull request #17 from IMZihad21/main

Destructure payload from decode function properly
This commit is contained in:
Toby Schneider
2022-06-22 12:11:09 +02:00
committed by GitHub

View File

@@ -94,7 +94,7 @@ class JWT {
const importAlgorithm = this.algorithms[options.algorithm]
if (!importAlgorithm)
throw new Error('algorithm not found')
const payload = this.decode(token)
const { payload } = this.decode(token)
if (payload.nbf && payload.nbf > Math.floor(Date.now() / 1000)) {
if (options.throwError)
throw 'NOT_YET_VALID'