not using stack param

This commit is contained in:
Miodec 2021-08-18 01:17:13 +01:00
parent 719e8fb26c
commit 4f96abd87d

View file

@ -5,17 +5,10 @@ module.exports = {
async authenticateRequest(req, res, next) {
try {
const { authorization } = req.headers;
if (!authorization)
throw new MonkeyError(401, "Unauthorized", "No authorization header");
if (!authorization) throw new MonkeyError(401, "Unauthorized");
const token = authorization.split(" ");
if (token[0].trim() !== "Bearer")
return next(
new MonkeyError(
400,
"Invalid Token",
"Only bearer tokens are accepted."
)
);
return next(new MonkeyError(400, "Invalid Token"));
req.decodedToken = await verifyIdToken(token[1]);
return next();
} catch (e) {