Skip to content

Commit

Permalink
fix: regression introduced in 58f7348
Browse files Browse the repository at this point in the history
  • Loading branch information
panva committed Nov 11, 2019
1 parent de63a7c commit 4738a8b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/helpers/jwt.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,12 @@ class JWT {
try {
({ protected: header, payload } = JWS.verify(jwt, keyOrStore, opts));
} catch (err) {
if (isKeyStore(keyOrStore) && keyOrStore.stale()) {
await keyOrStore.refresh();
({ protected: header, payload } = JWS.verify(jwt, keyOrStore, opts));
} else {
if (!isKeyStore(keyOrStore) || typeof keyOrStore.fresh !== 'function' || keyOrStore.fresh()) {
throw err;
}

await keyOrStore.refresh();
({ protected: header, payload } = JWS.verify(jwt, keyOrStore, opts));
}

payload = JSON.parse(payload);
Expand Down

0 comments on commit 4738a8b

Please sign in to comment.