diff --git a/src/verifier.js b/src/verifier.js index 92e92a2..1d9a213 100644 --- a/src/verifier.js +++ b/src/verifier.js @@ -288,7 +288,7 @@ function verify( throw e } - const { header, payload, signature } = decoded + const { header, payload, signature, input } = decoded const cacheContext = { cache, token, @@ -309,7 +309,7 @@ function verify( try { verifyToken(key, decoded, validationContext) - return cacheSet(cacheContext, complete ? { header, payload, signature, input: token } : payload) + return cacheSet(cacheContext, complete ? { header, payload, signature, input } : payload) } catch (e) { throw cacheSet(cacheContext, e) } diff --git a/test/verifier.spec.js b/test/verifier.spec.js index 51892a7..c898999 100644 --- a/test/verifier.spec.js +++ b/test/verifier.spec.js @@ -117,7 +117,7 @@ test('it correctly verifies a token - sync', t => { header: { typ: 'JWT', alg: 'HS256' }, payload: { a: 1 }, signature: '57TF7smP9XDhIexBqPC-F1toZReYZLWb_YRU5tv0sxM', - input: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhIjoxfQ.57TF7smP9XDhIexBqPC-F1toZReYZLWb_YRU5tv0sxM' + input: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhIjoxfQ' } )