diff --git a/CommonServer/Middleware/BearerTokenAuthorization.ts b/CommonServer/Middleware/BearerTokenAuthorization.ts index 4091d88025..deccac67f7 100644 --- a/CommonServer/Middleware/BearerTokenAuthorization.ts +++ b/CommonServer/Middleware/BearerTokenAuthorization.ts @@ -17,13 +17,15 @@ export default class BearerTokenAuthorization { try { req = req as OneUptimeRequest; - if (req.headers?.['authorization'] || req.headers?.['Authorization']) { + if ( + req.headers?.['authorization'] || + req.headers?.['Authorization'] + ) { let token: string | undefined | Array = req.headers['authorization'] || req.headers['Authorization']; token = token?.toString().replace('Bearer ', ''); if (token) { - const tokenData: JSONObject = JSONWebToken.decodeJsonPayload(token); @@ -33,7 +35,9 @@ export default class BearerTokenAuthorization { } } - throw new NotAuthorizedException('Invalid bearer token, or bearer token not provided.'); + throw new NotAuthorizedException( + 'Invalid bearer token, or bearer token not provided.' + ); } catch (err) { next(err); }