Skip to content

Commit

Permalink
Adding @dschenkelman feedback.
Browse files Browse the repository at this point in the history
  • Loading branch information
pose committed Apr 10, 2015
1 parent 1e46234 commit 19e6cc6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,13 @@ module.exports.verify = function(jwtString, secretOrPublicKey, options, callback

}

if (!jws.isValid(jwtString)) {
var decodedToken = jws.decode(jwtString);

if (!decodedToken) {
return done(new JsonWebTokenError('invalid token'));
}

var header = jws.decode(jwtString).header;
var header = decodedToken.header;

if (!~options.algorithms.indexOf(header.alg)) {
return done(new JsonWebTokenError('invalid signature'));
Expand Down

0 comments on commit 19e6cc6

Please sign in to comment.