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.2

4

lib/authorise.js

@@ -62,3 +62,3 @@ /**

if (!token) {
return next(error('invalid_token', 'The access token provided is invalid.'));
return next(error('invalid_grant', 'The access token provided is invalid.'));
}

@@ -68,3 +68,3 @@

if (token.expires !== null && (!token.expires || token.expires < this.now)) {
return next(error('invalid_token', 'The access token provided has expired.'));
return next(error('invalid_grant', 'The access token provided has expired.'));
}

@@ -71,0 +71,0 @@

@@ -34,3 +34,2 @@ /**

case 'invalid_request':
case 'invalid_token':
this.code = 400;

@@ -37,0 +36,0 @@ break;

{
"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.2",
"keywords": [

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

@@ -52,3 +52,3 @@ # Node OAuth2 Server [![Build Status](https://travis-ci.org/nightworld/node-oauth2-server.png?branch=master)](https://travis-ci.org/nightworld/node-oauth2-server)

- Does not yet support authorization code grant type
- Does not yet support authorization code grant type (NOTE: this has landed in the [https://github.com/nightworld/node-oauth2-server/tree/2.0](2.0 branch) (still unstable))

@@ -55,0 +55,0 @@ ## Options

@@ -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', {

@@ -111,9 +111,5 @@ /**

getClient: function (id, secret, callback) {
try {
id.should.equal('thom');
secret.should.equal('nightworld');
callback(false, false);
} catch (e) {
return done(e);
}
id.should.equal('thom');
secret.should.equal('nightworld');
callback(false, false);
}

@@ -135,9 +131,5 @@ },

getClient: function (id, secret, callback) {
try {
id.should.equal('thom');
secret.should.equal('nightworld');
callback(false, false);
} catch (e) {
return done(e);
}
id.should.equal('thom');
secret.should.equal('nightworld');
callback(false, false);
}

@@ -601,8 +593,4 @@ },

saveAccessToken: function (accessToken, clientId, userId, expires, callback) {
try {
accessToken.should.equal('thommy');
callback();
} catch (e) {
return callback(e);
}
accessToken.should.equal('thommy');
callback();
}

@@ -666,12 +654,10 @@ },

saveAccessToken: function (accessToken, clientId, userId, expires, callback) {
try {
accessToken.should.be.a('string');
accessToken.should.have.length(40);
clientId.should.equal('thom');
userId.should.equal(1);
(+expires).should.be.within(10, (+new Date()) + 3600000);
callback();
} catch (e) {
return callback(e);
}
accessToken.should.be.a('string');
accessToken.should.have.length(40);
clientId.should.equal('thom');
userId.should.equal(1);
var d = new Date;
d.setSeconds(d.getSeconds() + 3600);
(+expires).should.be.approximately(+d, 1);
callback();
}

@@ -706,12 +692,10 @@ },

saveRefreshToken: function (refreshToken, clientId, userId, expires, callback) {
try {
refreshToken.should.be.a('string');
refreshToken.should.have.length(40);
clientId.should.equal('thom');
userId.should.equal(1);
(+expires).should.be.within(10, (+new Date()) + 1209600000);
callback();
} catch (e) {
return callback(e);
}
refreshToken.should.be.a('string');
refreshToken.should.have.length(40);
clientId.should.equal('thom');
userId.should.equal(1);
var d = new Date;
d.setSeconds(d.getSeconds() + 1209600);
(+expires).should.be.approximately(+d, 1);
callback();
}

@@ -718,0 +702,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