-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
ISSUE_NUMBER: GH-5
Description
The isAuthenticated middleware in middlewares/auth.js lacks proper error handling. When an error occurs during token verification or user lookup, the error is only logged to the console, and the client receives no indication of an authentication failure.
File: repositories/QuestionBankapi/middlewares/auth.js
Line: 16
Severity: high
Current Behavior
Errors during token verification or user lookup are only logged to the console.
Expected Behavior
The middleware should send an error response to the client when an error occurs.
Suggested Fix
Modify the catch block to send an appropriate error response to the client.
Code Context
} catch (error) {
console.log(error);
}Additional Notes
This can lead to unexpected behavior and a poor user experience, as the client might not be aware that authentication has failed.