We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a9913df commit 1c352f3Copy full SHA for 1c352f3
src/app/middlewares/auth.ts
@@ -14,7 +14,7 @@ const auth =
14
throw new ApiError(StatusCodes.UNAUTHORIZED, 'You are not authorized');
15
}
16
17
- if (tokenWithBearer && tokenWithBearer.startsWith('Bearer')) {
+ if (tokenWithBearer.startsWith('Bearer')) {
18
const token = tokenWithBearer.split(' ')[1];
19
20
//verify token
@@ -34,6 +34,8 @@ const auth =
34
35
36
next();
37
+ } else {
38
+ throw new ApiError(StatusCodes.UNAUTHORIZED, 'You are not authorized');
39
40
} catch (error) {
41
next(error);
0 commit comments