Skip to content

Commit

Permalink
no need for lodash
Browse files Browse the repository at this point in the history
  • Loading branch information
mojitoj committed May 2, 2023
1 parent cbf76a7 commit 955de6f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/AuthUtils.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const _ = require("lodash");
const jwt = require("jsonwebtoken");
const logger = require("./logger");

Expand All @@ -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;
}

Expand Down

0 comments on commit 955de6f

Please sign in to comment.