diff --git a/extauth/index.js b/extauth/index.js index 89bcbc1..65ce7e2 100644 --- a/extauth/index.js +++ b/extauth/index.js @@ -110,7 +110,7 @@ module.exports.init = function(config, logger, stats) { delete(req.headers['authorization']); delete(req.headers['x-api-key']); if (sendErr) { - return sendError(req, res, next, logger, stats, 'access_denied', 'missing_authorization'); + return sendError(req, res, next, logger, stats, 'missing_authorization', 'missing_authorization'); } } else { var jwtdecode = JWS.parse(jwtpayload[1]); @@ -133,7 +133,7 @@ module.exports.init = function(config, logger, stats) { delete(req.headers['authorization']); delete(req.headers['x-api-key']); if (sendErr) { - return sendError(req, res, next, logger, stats, 'access_denied','invalid_token'); + return sendError(req, res, next, logger, stats, 'invalid_token','invalid_token'); } } } else if (!kid && keyType === 'jwk') { @@ -141,7 +141,7 @@ module.exports.init = function(config, logger, stats) { delete(req.headers['authorization']); delete(req.headers['x-api-key']); if (sendErr) { - return sendError(req, res, next, logger, stats, 'access_denied','invalid_token'); + return sendError(req, res, next, logger, stats, 'invalid_token','invalid_token'); } } else { var jwk = getJWK(kid); @@ -150,7 +150,7 @@ module.exports.init = function(config, logger, stats) { delete(req.headers['authorization']); delete(req.headers['x-api-key']); if (sendErr) { - return sendError(req, res, next, logger, stats, 'access_denied','invalid_authorization'); + return sendError(req, res, next, logger, stats, 'invalid_authorization','invalid_authorization'); } } else { debug("Found JWK"); @@ -181,7 +181,7 @@ module.exports.init = function(config, logger, stats) { delete(req.headers['authorization']); delete(req.headers['x-api-key']); if (sendErr) { - return sendError(req, res, next, logger, stats,'access_denied', 'missing_authorization'); + return sendError(req, res, next, logger, stats,'missing_authorization', 'missing_authorization'); } } } @@ -190,7 +190,7 @@ module.exports.init = function(config, logger, stats) { delete(req.headers['authorization']); delete(req.headers['x-api-key']); if (sendErr) { - return sendError(req, res, next, logger, stats,'access_denied', 'invalid_authorization'); + return sendError(req, res, next, logger, stats,'invalid_authorization', 'invalid_authorization'); } } next(); diff --git a/oauthv2/index.js b/oauthv2/index.js index 4bad808..0eab845 100644 --- a/oauthv2/index.js +++ b/oauthv2/index.js @@ -95,7 +95,7 @@ module.exports.init = function(config, logger, stats) { return next(); } else { debug('invalid token'); - return sendError(req, res, next, logger, stats, 'access_denied', 'invalid_token'); + return sendError(req, res, next, logger, stats, 'invalid_token', 'invalid_token'); } } @@ -130,7 +130,7 @@ module.exports.init = function(config, logger, stats) { return next(); } else { debug('invalid token'); - return sendError(req, res, next, logger, stats,'access_denied', 'invalid_token'); + return sendError(req, res, next, logger, stats,'invalid_token', 'invalid_token'); } } else { if (tokenvalue === null || tokenvalue === undefined) { @@ -164,7 +164,7 @@ module.exports.init = function(config, logger, stats) { return next(); } else { debug('invalid token'); - return sendError(req, res, next, logger, stats, 'access_denied', 'invalid_token'); + return sendError(req, res, next, logger, stats, 'invalid_token', 'invalid_token'); } } else { authorize(req, res, next, logger, stats, decodedToken.payloadObj);