koa-oauth-server
Advanced tools
Comparing version 0.0.4 to 0.0.5
## Changelog | ||
### 0.0.5 | ||
- Expose WWW-Authenticate headers correctly on koa response | ||
- Update error handler to support the new base error-inherited version of OAuth2Error | ||
- Update node-oauth2-server dependency from 2.1.1 to 2.2.1 | ||
### 0.0.4 | ||
- Update node-oauth2-server dependency from 2.0 to 2.1.1 | ||
### 0.0.3 | ||
@@ -4,0 +12,0 @@ - Update node-oauth2-server dependency from 2.x-RC to 2.0 stable |
11
index.js
@@ -122,7 +122,10 @@ /** | ||
ctx.status = err.code; | ||
if (err.headers) | ||
ctx.set(err.headers); | ||
ctx.body = {}; | ||
for (var key in err) { | ||
if (key !== 'stack') | ||
ctx.body[key] = err[key]; | ||
} | ||
['code', 'error', 'error_description'].forEach(function (key) { | ||
ctx.body[key] = err[key]; | ||
}); | ||
} | ||
@@ -129,0 +132,0 @@ |
{ | ||
"name": "koa-oauth-server", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "OAuth provider for koa", | ||
@@ -24,3 +24,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"node-oauth2-server": "2.1.1", | ||
"node-oauth2-server": "2.2.1", | ||
"co-body": "0.0.1" | ||
@@ -27,0 +27,0 @@ }, |
@@ -33,3 +33,2 @@ /** | ||
describe('Error Handler', function () { | ||
it('should return an oauth conformat response', function (done) { | ||
@@ -36,0 +35,0 @@ var app = bootstrap(); |
@@ -92,2 +92,3 @@ /** | ||
.send({ grant_type: 'password' }) | ||
.expect('WWW-Authenticate', 'Basic realm="Service"') | ||
.expect(400, /invalid or missing client_id parameter/i, done); | ||
@@ -107,2 +108,3 @@ }); | ||
.send({ grant_type: 'password', client_id: 'thom' }) | ||
.expect('WWW-Authenticate', 'Basic realm="Service"') | ||
.expect(400, /invalid or missing client_id parameter/i, done); | ||
@@ -118,2 +120,3 @@ }); | ||
.send({ grant_type: 'password', client_id: 'thom' }) | ||
.expect('WWW-Authenticate', 'Basic realm="Service"') | ||
.expect(400, /missing client_secret parameter/i, done); | ||
@@ -142,2 +145,3 @@ }); | ||
}) | ||
.expect('WWW-Authenticate', 'Basic realm="Service"') | ||
.expect(400, done); | ||
@@ -162,2 +166,3 @@ }); | ||
.set('Authorization', 'Basic dGhvbTpuaWdodHdvcmxk') | ||
.expect('WWW-Authenticate', 'Basic realm="Service"') | ||
.expect(400, done); | ||
@@ -210,2 +215,3 @@ }); | ||
}) | ||
.expect('WWW-Authenticate', 'Basic realm="Service"') | ||
.expect(400, /client credentials are invalid/i, done); | ||
@@ -237,2 +243,3 @@ }); | ||
}) | ||
.expect('WWW-Authenticate', 'Basic realm="Service"') | ||
.expect(400, /grant type is unauthorised for this client_id/i, done); | ||
@@ -239,0 +246,0 @@ }); |
@@ -59,4 +59,4 @@ /** | ||
}) | ||
.expect('WWW-Authenticate', 'Basic realm="Service"') | ||
.expect(400, /missing parameters. \\"username\\" and \\"password\\"/i, done); | ||
}); | ||
@@ -93,4 +93,3 @@ | ||
.expect(400, /user credentials are invalid/i, done); | ||
}); | ||
}); |
56123
1278
+ Addednode-oauth2-server@2.2.1(transitive)
- Removednode-oauth2-server@2.1.1(transitive)
Updatednode-oauth2-server@2.2.1