jaredhanson / jaredhanson/passport
failWithError omitted error information inside strategy
- Dominant language
- JavaScript
- Stars
- 23.5k
- Forks
- 1.3k
- PR merge metrics
- No merged PRs in 30d
Description
In middleware/authenticate.js 171
```
if (options.failWithError) {
return next(new AuthenticationError(http.STATUS_CODES[res.statusCode], rstatus));
}
```
which only return http.STATUS_CODES[res.statusCode] as message and there is no way to know what's the error cause by the strategy
There should be a way to handle error happen inside strategy, like token is invalid/expired if you are using iwt. AuthenticationError should contain that information instead of having a standard 401 Unauthorized message. Or even better to return the error throw by the strategy.
Contributor guide
Research direction
Start in middleware/authenticate.js around line 171 and trace how failWithError handles errors from the authentication strategy. Compare the current AuthenticationError message with the strategy failure cases described, including invalid or expired tokens. Done means the strategy’s underlying error information is preserved or returned according to a clearly defined behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- authentication, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100