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.1 to 1.5.2-invalid-token

8

Changelog.md

@@ -5,2 +5,8 @@ ## Changelog

### 1.5.2
- Fix expiration checking. (Previously the current time was mistakenly cached up instantiation)
### 1.5.1
- Add repository to package.json
### 1.5.0

@@ -54,2 +60,2 @@ - Add support for non-expiring tokens (set accessTokenLifetime/refreshTokenLifetime = null)

- Use async crypto.randomBytes in token generation
- Refactor structure, break into more files
- Refactor structure, break into more files

4

lib/authorise.js

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

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

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

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

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

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

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

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

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

this.authCodeLifetime = config.authCodeLifetime || 30;
this.now = new Date();

@@ -98,2 +97,3 @@ this.regex = {};

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

@@ -100,0 +100,0 @@ 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.1",
"version": "1.5.2-invalid-token",
"keywords": [

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

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

## 2.0
Version is under active development, for a preview see the 2.0 branch: https://github.com/nightworld/node-oauth2-server/tree/2.0
## Installation

@@ -7,0 +10,0 @@

@@ -17,2 +17,39 @@ var express = require('express'),

app.get('/oauth/authorise', function (req, res, next) {
if (!req.session.user) {
return res.redirect('/login?redirect=' + req.path + '&client_id=' + req.query.client_id +
'&redirect_uri=' + req.query.redirect_uri);
}
res.render('authorise', {
client_id: req.query.client_id,
redirect_uri: req.query.redirect_uri
});
});
app.post('/oauth/authorise', app.oauth.codeGrant(function (req) {
return req.body.auth === 'yes';
}));
app.get('/login', function (req, res, next) {
res.render('login', {
redirect: req.query.redirect,
client_id: req.query.client_id,
redirect_uri: req.query.redirect_uri
});
});
app.post('/login', function (req, res, next) {
if (req.body.email !== 'thom@nightworld.com') {
res.render('login', {
redirect: req.body.redirect,
client_id: req.body.client_id,
redirect_uri: req.body.redirect_uri
});
} else {
return res.redirect((req.body.redirect || '/home') + '?client_id=' + req.body.client_id +
'&redirect_uri=' + req.body.redirect_uri);
}
});
app.get('/one', function (req, res) {

@@ -19,0 +56,0 @@ res.send('Secret area');

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

app.set('json spaces', 0);
app.use(express.bodyParser());

@@ -404,3 +405,3 @@ app.use(oauth.handler());

})
.expect(200, /"access_token": "(.*)",\n\s+"refresh_token": "(.*)"/i, done);
.expect(200, /"access_token":"(.*)","refresh_token":"(.*)"/i, done);

@@ -447,3 +448,3 @@ });

})
.expect(200, /"access_token": "(.*)",\n\s+"refresh_token": "(.*)"/i, done);
.expect(200, /"access_token":"(.*)","refresh_token":"(.*)"/i, done);

@@ -646,3 +647,3 @@ });

.send(validBody)
.expect(/"access_token": "thommy"/, 200, done);
.expect(/"access_token":"thommy"/, 200, done);

@@ -649,0 +650,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