Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

express-jwt

Package Overview
Dependencies
Maintainers
5
Versions
71
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-jwt - npm Package Compare versions

Comparing version 3.1.0 to 3.2.0

43

lib/index.js

@@ -87,4 +87,4 @@ var jwt = require('jsonwebtoken');

async.parallel([
function(callback){
async.waterfall([
function getSecret(callback){
var arity = secretCallback.length;

@@ -97,20 +97,29 @@ if (arity == 4) {

},
function(callback){
isRevokedCallback(req, dtoken.payload, callback);
function verifyToken(secret, callback) {
jwt.verify(token, secret, options, function(err, decoded) {
if (err && credentialsRequired) {
callback(new UnauthorizedError('invalid_token', err));
} else {
callback(null, decoded);
}
});
},
function checkRevoked(decoded, callback) {
isRevokedCallback(req, dtoken.payload, function (err, revoked) {
if (err) {
callback(err);
}
else if (revoked) {
callback(new UnauthorizedError('revoked_token', {message: 'The token has been revoked.'}));
} else {
callback(null, decoded);
}
});
}
], function(err, results){
], function (err, result){
if (err) { return next(err); }
var revoked = results[1];
if (revoked){
return next(new UnauthorizedError('revoked_token', { message: 'The token has been revoked.'}));
}
var secret = results[0];
jwt.verify(token, secret, options, function(err, decoded) {
if (err && credentialsRequired) return next(new UnauthorizedError('invalid_token', err));
req[_requestProperty] = decoded;
next();
});
req[_requestProperty] = result;
next();
});

@@ -117,0 +126,0 @@ };

{
"name": "express-jwt",
"version": "3.1.0",
"version": "3.2.0",
"description": "JWT authentication middleware.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -44,2 +44,8 @@ # express-jwt

If you are using a base64 URL-encoded secret, pass a `Buffer` with `base64` encoding as the secret instead of a string:
```javascript
jwt({ secret: new Buffer('shhhhhhared-secret', 'base64') })
```
Optionally you can make some paths unprotected as follows:

@@ -64,2 +70,3 @@

```javascript

@@ -169,4 +176,4 @@ jwt({ secret: publicKey, requestProperty: 'auth' });

You might want to use this module to identify registered users without preventing unregistered clients to access to some data, you
can do it using the option _credentialsRequired_:
You might want to use this module to identify registered users while still providing access to unregistered users. You
can do this by using the option _credentialsRequired_:

@@ -173,0 +180,0 @@ app.use(jwt({

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc