I am quite new at using passport for authentication over node, hence the lot of code snippets
my server is configured as :
var router = require(\'./a
In most examples on the web, routing code is done like this:
app.get('/auth/google', passport.authenticate('google'));
According to the Express Reference, callbacks of the app.get method are given three arguments, request, response and 'next'. That means, the authenticate method in the above example returns a function object and it is executed with three the arguments request, response and 'next'.
So, if you would like do authentication in the callback function of the app.get method like this:
app.get('/auth/google', function() {
passport.authenticate('google', {scope: ['profile', 'email']});
});
then you should write:
app.get('/auth/google', function(request, response, next) {
passport.authenticate('google', {scope: ['profile', 'email']})(request, response, next);
});