node-oauth2-server
Advanced tools
Comparing version 1.5.3-invalid-token to 1.5.3
@@ -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 @@ |
@@ -36,5 +36,2 @@ /** | ||
break; | ||
case 'invalid_token': | ||
this.code = 401; | ||
break; | ||
case 'server_error': | ||
@@ -41,0 +38,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.3-invalid-token", | ||
"version": "1.5.3", | ||
"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 |
@@ -63,3 +63,3 @@ /** | ||
.set('Authorization', 'Bearer thom') | ||
.expect(401, /the access token provided is invalid/i, done); | ||
.expect(400, /the access token provided is invalid/i, done); | ||
}); | ||
@@ -93,3 +93,3 @@ | ||
.send({ access_token: 'thom' }) | ||
.expect(401, /the access token provided is invalid/i, done); | ||
.expect(400, /the access token provided is invalid/i, done); | ||
}); | ||
@@ -111,3 +111,3 @@ | ||
.get('/?access_token=thom') | ||
.expect(401, /the access token provided is invalid/i, done); | ||
.expect(400, /the access token provided is invalid/i, done); | ||
}); | ||
@@ -141,3 +141,3 @@ | ||
.get('/?access_token=thom') | ||
.expect(401, /the access token provided is invalid/i, done); | ||
.expect(400, /the access token provided is invalid/i, done); | ||
}); | ||
@@ -156,3 +156,3 @@ | ||
.get('/?access_token=thom') | ||
.expect(401, /the access token provided has expired/i, done); | ||
.expect(400, /the access token provided has expired/i, done); | ||
}); | ||
@@ -159,0 +159,0 @@ |
@@ -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 @@ }, |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1
85188
1797