diff --git a/src/middleware/index.js b/src/middleware/index.js index 0dd8f439..cc905f75 100644 --- a/src/middleware/index.js +++ b/src/middleware/index.js @@ -47,16 +47,12 @@ export let normalizeAuthToken = function(options = {}) { } } - // If we don't already have token in the header check for a cookie - if (!token && req.cookies && req.cookies[options.cookie]) { - token = req.cookies[options.cookie]; - } // Check the body next if we still don't have a token - else if (req.body.token) { + if (req.body.token) { token = req.body.token; delete req.body.token; } - // Finally, check the query string. (worst method) + // Finally, check the query string. (worst method but nice for quick local dev) else if (req.query.token) { token = req.query.token; delete req.query.token; diff --git a/test/src/middleware.test.js b/test/src/middleware.test.js index a57b9b4c..0acb7a5f 100644 --- a/test/src/middleware.test.js +++ b/test/src/middleware.test.js @@ -82,32 +82,6 @@ describe('Middleware', () => { }); }); - describe('Auth token passed via cookie', () => { - it('grabs the token', () => { - const req = Object.assign({}, MockRequest, { - cookies: { - 'feathers-jwt': 'my-token' - } - }); - - middleware.normalizeAuthToken(options)(req, MockResponse, MockNext); - expect(req.feathers.token).to.deep.equal('my-token'); - }); - - it('supports a custom cookie', () => { - const req = Object.assign({}, MockRequest, { - cookies: { - 'my-cookie': 'my-token' - } - }); - - const newOptions = Object.assign({}, options, {cookie: 'my-cookie'}); - - middleware.normalizeAuthToken(newOptions)(req, MockResponse, MockNext); - expect(req.feathers.token).to.deep.equal('my-token'); - }); - }); - describe('Auth token passed via body', () => { it('grabs the token', () => { const req = Object.assign({}, MockRequest, {