Open Cliff-R-K opened 3 years ago
@burton666
app.get("route", basicAuth(....), (req, res) => {.....})
@tiagodinis33 but if you do it that way you can't use the Request parameters to fetch the basicauth details from somewhere.
It would be nice if there was a way to use the request parameter with app.get
. Or at least get the req.auth
boolean value provided by the middleware.
this.app.get( `/getToken`, basicAuth( {
users: {
uname: 'secret',
},
challenge: true,
unauthorizedResponse: function( req: Request )
{
console.log( req.auth )
}
} ), this.getToken )
I can't figure out how to use express-basic-auth correctly. If I make a POST-request to "/abort" with correct authorization everything seams to work correctly. But if I enter the wrong credentials in the header I get the correct "Credentials rejected" message. But it still triggers the "/abort" endpoint and also gives med console.log outputs and 200 message:sucess
What am I missing ? App.js
abort.js