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

node-oauth2-server

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-oauth2-server - npm Package Compare versions

Comparing version 1.5.2-invalid-token to 1.5.3-invalid-token

4

lib/error.js

@@ -34,5 +34,7 @@ /**

case 'invalid_request':
case 'invalid_token':
this.code = 400;
break;
case 'invalid_token':
this.code = 401;
break;
case 'server_error':

@@ -39,0 +41,0 @@ this.code = 503;

@@ -96,3 +96,3 @@ /**

req.oauth = { internal: false };
oauth.now = new Date;
oauth.now = new Date();

@@ -134,2 +134,2 @@ if (req.path === '/oauth/token') {

};
};
};
{
"name": "node-oauth2-server",
"description": "Complete, compliant and well tested module for implementing an OAuth2 Server/Provider with express in node.js",
"version": "1.5.2-invalid-token",
"version": "1.5.3-invalid-token",
"keywords": [

@@ -6,0 +6,0 @@ "oauth",

@@ -29,6 +29,24 @@ var express = require('express'),

app.post('/oauth/authorise', app.oauth.codeGrant(function (req) {
return req.body.auth === 'yes';
}));
app.post('/oauth/authorise', function (req, res, next) {
if (!req.session.user) {
return res.redirect('/login?client_id=' + req.query.client_id +
'&redirect_uri=' + req.query.redirect_uri);
}
next();
}, app.oauth.codeGrant);
app.post('/oauth/authorise', function (req, res, next) {
if (!req.session.user) {
return res.redirect('/login?client_id=' + req.query.client_id +
'&redirect_uri=' + req.query.redirect_uri);
}
next();
}, app.oauth.codeGrant(function (req, next) {
next(null, req.body.allow === 'yes', req.session.user.id, req.session.user);
}), function (err, req, res, next) {
res.render('authoriseError');
});
app.get('/login', function (req, res, next) {

@@ -35,0 +53,0 @@ res.render('login', {

@@ -63,3 +63,3 @@ /**

.set('Authorization', 'Bearer thom')
.expect(400, /the access token provided is invalid/i, done);
.expect(401, /the access token provided is invalid/i, done);
});

@@ -93,3 +93,3 @@

.send({ access_token: 'thom' })
.expect(400, /the access token provided is invalid/i, done);
.expect(401, /the access token provided is invalid/i, done);
});

@@ -111,3 +111,3 @@

.get('/?access_token=thom')
.expect(400, /the access token provided is invalid/i, done);
.expect(401, /the access token provided is invalid/i, done);
});

@@ -141,3 +141,3 @@

.get('/?access_token=thom')
.expect(400, /the access token provided is invalid/i, done);
.expect(401, /the access token provided is invalid/i, done);
});

@@ -156,3 +156,3 @@

.get('/?access_token=thom')
.expect(400, /the access token provided has expired/i, done);
.expect(401, /the access token provided has expired/i, done);
});

@@ -159,0 +159,0 @@

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