I have one post like this
app.post('/auth', passport.initialize(), passport.authenticate('local', { session: false,scope: [] }), serialize, generateToken, respond);
this is working correctly.
Now I have made above post as a function and calling from different page
accesstokenController.auth = function(req, res) {
console.log('Here auth called');
passport.initialize(), passport.authenticate(
'local', {
session: false,
scope: []
}), serialize, generateToken, respond
};
and calling this method from differnt rout page.
This is not working means passport.intialize() or passport.authenticate is not being called
Router calling method
var oauth = require("../oauth/accesstoken");
router.post('/auth', function(req, res) {
oauth.auth(req, res);
});
What's wrong there
Thanks