|
|
@ -17,10 +17,6 @@ var passportFacebook = require('../auth/facebook');
|
|
|
|
var passportGoogle = require('../auth/google');
|
|
|
|
var passportGoogle = require('../auth/google');
|
|
|
|
var passportGitHub = require('../auth/github');
|
|
|
|
var passportGitHub = require('../auth/github');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* creation Token */
|
|
|
|
/* creation Token */
|
|
|
|
getToken = function (headers) {
|
|
|
|
getToken = function (headers) {
|
|
|
|
if (headers && headers.authorization) {
|
|
|
|
if (headers && headers.authorization) {
|
|
|
@ -289,25 +285,34 @@ function ensureAuthenticated(req, res, next) {
|
|
|
|
/* FACEBOOK ROUTER */
|
|
|
|
/* FACEBOOK ROUTER */
|
|
|
|
router.get('/facebook', passportFacebook.authenticate('facebook'));
|
|
|
|
router.get('/facebook', passportFacebook.authenticate('facebook'));
|
|
|
|
|
|
|
|
|
|
|
|
router.get('/facebook/callback', passportFacebook.authenticate('facebook', { failureRedirect: '/login' }), function(req, res) {
|
|
|
|
router.get('/facebook/callback', passportFacebook.authenticate('facebook', { successRedirect : '/', failureRedirect: '/login' }), function(req, res) {
|
|
|
|
// Successful authentication, redirect home.
|
|
|
|
// Successful authentication, redirect home.
|
|
|
|
res.redirect('/');
|
|
|
|
res.redirect('/');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
router.get('/facebook',
|
|
|
|
|
|
|
|
passport.authenticate('facebook', { scope: ['read_stream', 'publish_actions'] })
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
/* GOOGLE ROUTER */
|
|
|
|
/* GOOGLE ROUTER */
|
|
|
|
router.get('/google', passportGoogle.authenticate('google', { scope: 'https://www.google.com/m8/feeds' }));
|
|
|
|
router.get('/google', passportGoogle.authenticate('google', { scope: 'https://www.google.com/m8/feeds' }));
|
|
|
|
|
|
|
|
|
|
|
|
router.get('/google/callback', passportGoogle.authenticate('google', { failureRedirect: '/login' }), function(req, res) {
|
|
|
|
router.get('/google/callback', passportGoogle.authenticate('google', { successRedirect : '/', failureRedirect: '/login' }), function(req, res) {
|
|
|
|
res.redirect('/');
|
|
|
|
res.redirect('/');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
router.get('/google',
|
|
|
|
|
|
|
|
passport.authenticate('google', { scope: ['read_stream', 'publish_actions'] })
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
/* GITHUB ROUTER */
|
|
|
|
/* GITHUB ROUTER */
|
|
|
|
router.get('/github', passportGitHub.authenticate('github', { scope: [ 'user:email' ] }));
|
|
|
|
router.get('/github', passportGitHub.authenticate('github', { scope: [ 'user:email' ] }));
|
|
|
|
|
|
|
|
|
|
|
|
router.get('/github/callback', passportGitHub.authenticate('github', { failureRedirect: '/login' }), function(req, res) {
|
|
|
|
router.get('/auth/github/callback', passportGitHub.authenticate('github', { successRedirect : '/', failureRedirect: '/login' }), function(req, res) {
|
|
|
|
// Successful authentication, redirect home.
|
|
|
|
// Successful authentication, redirect home.
|
|
|
|
res.redirect('/');
|
|
|
|
res.redirect('/');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
router.get('/github',
|
|
|
|
|
|
|
|
passport.authenticate('github', { scope: ['read_stream', 'publish_actions'] })
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
module.exports = router;
|
|
|
|
module.exports = router;
|
|
|
|