Skip to content

Commit

Permalink
fix: token.replace is not a function
Browse files Browse the repository at this point in the history
- Use empty string replace `false` boolean of lodash default value
  • Loading branch information
Chinlinlee committed Jun 13, 2022
1 parent 664c22f commit 4b87e27
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions plugins/tokenAuth/api/user/service/user.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function checkIsLoggedIn(req, res, next) {
*/
async function tokenAuthentication(req, res, next) {
try {
let token = _.get(req.headers, "authorization", false);
let token = _.get(req.headers, "authorization", "");
if (!token) {
return res
.status(400)
Expand Down Expand Up @@ -89,7 +89,7 @@ async function getTokenPermission(token, resourceType, interaction) {
}

async function checkTokenPermission(req, resourceType, interaction) {
let token = _.get(req.headers, "authorization", false);
let token = _.get(req.headers, "authorization", "");
token = token.replace("Bearer ", "");
let permission = await getTokenPermission(token, resourceType, interaction);
if (permission) {
Expand Down

0 comments on commit 4b87e27

Please sign in to comment.