The passport provides the req.logIn method if you want to authenticate manually. You can use it to log in to any user, even regardless of authentication.
You can use it here. As a rule, the administrator has a username that will have the isAdmin flag isAdmin .
Then put the middleware before passport.authenticate in your login. This will log in a new user, based only on the username if the current user isAdmin .
app.post('/login', function forceLogin(req, res, next) { if (!req.user.isAdmin) return next();
source share