Skip to content

Commit 48f7575

Browse files
hotfix: auth issue
1 parent 7c88ebc commit 48f7575

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

backend/src/config/authCheck.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ async function isAuthorized(
3535
try {
3636
// Verify the token
3737
const decoded = jwt.verify(token, TOKEN_SECRET) as DecodedJwtPayload;
38+
39+
if (!decoded?.user_id) {
40+
return res.status(401).json({
41+
error: "The token is either invalid or has expired",
42+
});
43+
}
3844

3945
const results = await userModel.getUsersByIds(decoded.user_id);
4046

0 commit comments

Comments
 (0)