You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I'm using passport-activedirectory in a rest api, to authenticate for token request.
When an error occurs, i.e. the password is wrong, it always calls a res.end with the error stack as a message and error code 500.
I was able to set the right status (401) in my error managing route in express, but with a workaround:
//error handling
app.use(function(err, req, res, next) {
//here the workaroun
if (/InvalidCredentialsError/.test(err.stack)) {
res.status(401);
return; // no res.end(mymessage) because it is called by the Strategy,error() of passport-activedirectory
}
//end workaround
res.locals.message = err.message;
res.locals.error = req.app.get('env') === 'development' ? err : {};
return res.boom.internal(err.message);
});
Is there a way to redefine the Strategy.error() method or to avoid it to call res.end, or set a custom message?
The text was updated successfully, but these errors were encountered:
Hi, I'm using passport-activedirectory in a rest api, to authenticate for token request.
When an error occurs, i.e. the password is wrong, it always calls a res.end with the error stack as a message and error code 500.
I was able to set the right status (401) in my error managing route in express, but with a workaround:
Is there a way to redefine the Strategy.error() method or to avoid it to call res.end, or set a custom message?
The text was updated successfully, but these errors were encountered: