diff --git a/lib/cartodb/middleware/context/apikey-credentials.js b/lib/cartodb/middleware/context/apikey-credentials.js index bde45da4..5302050e 100644 --- a/lib/cartodb/middleware/context/apikey-credentials.js +++ b/lib/cartodb/middleware/context/apikey-credentials.js @@ -1,10 +1,12 @@ 'use strict'; -module.exports = () => function apikeyTokenMiddleware(req, res, next) { - const apikeyCredentials = getApikeyCredentialsFromRequest(req); - res.locals.api_key = apikeyCredentials.token; - res.locals.apikeyUsername = apikeyCredentials.username; - return next(); +module.exports = function() { + return function apikeyTokenMiddleware(req, res, next) { + const apikeyCredentials = getApikeyCredentialsFromRequest(req); + res.locals.api_key = apikeyCredentials.token; + res.locals.apikeyUsername = apikeyCredentials.username; + return next(); + }; }; //--------------------------------------------------------------------------------