Skip to content

Commit 7047316

Browse files
committed
Assign authInfo when using assignProperty option.
1 parent b220766 commit 7047316

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

lib/middleware/authenticate.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,16 @@ module.exports = function authenticate(passport, name, options, callback) {
247247
}
248248
if (options.assignProperty) {
249249
req[options.assignProperty] = user;
250-
return next();
250+
if (options.authInfo !== false) {
251+
passport.transformAuthInfo(info, req, function(err, tinfo) {
252+
if (err) { return next(err); }
253+
req.authInfo = tinfo;
254+
next();
255+
});
256+
} else {
257+
next();
258+
}
259+
return;
251260
}
252261

253262
req.logIn(user, options, function(err) {

0 commit comments

Comments
 (0)