File size: 1,161 Bytes
e1d589b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | module.exports = function(passport) {
// POST Login Authenticate
var postLogin = passport.authenticate('signin', {
successRedirect: '/home',
failureRedirect: '/',
failureFlash : true
});
// POST Registration Authenticate
var postSignup = passport.authenticate('signup', {
successRedirect: '/',
failureRedirect: '/register',
failureFlash : true
});
// GET Facebook Login Authenticate & Callback
var getFacebookAuth = passport.authenticate('facebook', { scope: 'email' });
var getFacebookCallback = passport.authenticate('facebook', {
successRedirect: '/home',
failureRedirect: '/',
failureFlash: true
});
// GET Google Login Authenticate & Callback
var getGoogleAuth = passport.authenticate('google', { scope: ['profile','email'] });
var getGoogleCallback = passport.authenticate('google', {
successRedirect: '/home',
failureRedirect: '/',
failureFlash: true
});
return {
postLogin: postLogin,
postSignup: postSignup,
getFacebookAuth: getFacebookAuth,
getFacebookCallback: getFacebookCallback,
getGoogleAuth: getGoogleAuth,
getGoogleCallback: getGoogleCallback
};
};
|