mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-09-12 17:48:51 +08:00
not using stack param
This commit is contained in:
parent
719e8fb26c
commit
4f96abd87d
1 changed files with 2 additions and 9 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Reference in a new issue