node.js - Passport authenticate callback is not passed req and res -


This authentication works fine and I get a redirect:

  server.post (AuthPostRoute, Passport.authenticate ('local', {successRedirect: '/', failure redirection: '/ login'}));  

This authentication is hanging after the call back:

  server.post (authPostRoute, passport.authenticate ('local', function) (). Log ('callback'); console.log (argument)}));  

This logs the following piece:

  {'0': null, '1': {id: [gate / setter], first name: [[Gate / setter], active: [gates / setter], password: [gate / setter], '2': [gates / setter], email: [gate / setter], added: [gates / setter] , Active: [gates / setter] unspecified}  

But in the whole documentation () it seems as if it is relaxed and race passed, but it is not clearly. Then callback caller code:

node_module \ passport \ lib \ middleware \ authenticate.js

  strategy.success = function (user, info) {if (callback) {Return callback (blank, user, info); }  

does not pass those parameters. What am i doing wrong

OK, I was working with executing my custom certification and changing it yesterday 9 hours In order to expose the model outside the passport request, I was slightly lit between the node-yam arrangement and arranging things to flow. This code example is accurate, I need to read more carefully :

  // Traditional route handler, pass / race server Authentication ('local', function (error, user, information) {if (mistake) {Back Next (mistake): Post (authPostRoute, function (req, res, next) ;} If (! User) {return res.redirect ('/');} // req / res Closer organized in req.logIn (user, function (mistake) {if (err) {back next (mistake);} Return res.send (user);});}) (rick, ridge, next);});  

Comments