From 955de6f23c13820b73a48027cea9145bdee53edf Mon Sep 17 00:00:00 2001 From: Mohammad Jafari Date: Tue, 2 May 2023 16:01:46 -0700 Subject: [PATCH] no need for lodash --- lib/AuthUtils.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/AuthUtils.js b/lib/AuthUtils.js index b1a0a76..240c3b3 100644 --- a/lib/AuthUtils.js +++ b/lib/AuthUtils.js @@ -1,4 +1,3 @@ -const _ = require("lodash"); const jwt = require("jsonwebtoken"); const logger = require("./logger"); @@ -9,8 +8,8 @@ JWT_PUBLIC_KEY_RAW_VALUE || logger.error("JWT_PUBLIC_KEY is not provided."); const JWT_PUBLIC_KEY = JWT_PUBLIC_KEY_RAW_VALUE.replace(/\\n/gm, "\n"); function getToken(req) { - const authHeader = _.get(req, "headers.authorization") || ""; - const token = _.get(authHeader.split("Bearer "), "[1]"); + const authHeader = req.headers.authorization || ""; + const token = authHeader.split("Bearer ")?.[1]; return token; }