express
express copied to clipboard
Express 3.x with BasicAuth: There is no request.remoteUser
I'm migrating an express 2.x to 3.x app with the BasicAuth middleware and I need to get the remoteUser from the request, but it come as undefined.
The code:
var express = require('express');
var app = express.createServer();
var basicAuth = express.basicAuth(function(username, password) {
return (username == 'admin' && password == '12345');
}, 'Restrict area, please identify');
app.get('/admin', basicAuth, function(req, res){
res.end('remoteUser: ' + req.remoteUser);
});
app.listen(8080);
Any idea?
It has been renamed as req.user
Thank you very much!
just added an alias back to req.remoteUser
Is it normal that both those prop are set to "true" when I test ? I was thinking they would contain the actual user name.