|
|
|
@ -18,10 +18,13 @@ var passportFacebook = require('../auth/facebook');
|
|
|
|
|
var passportGoogle = require('../auth/google');
|
|
|
|
|
var passportGitHub = require('../auth/github');
|
|
|
|
|
|
|
|
|
|
<<<<<<< HEAD
|
|
|
|
|
//var router = express.Router([options]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
=======
|
|
|
|
|
>>>>>>> 98b837065bd51764d8da85c7972979c9fcf214dc
|
|
|
|
|
/* creation Token */
|
|
|
|
|
getToken = function (headers) {
|
|
|
|
|
if (headers && headers.authorization) {
|
|
|
|
@ -290,15 +293,20 @@ function ensureAuthenticated(req, res, next) {
|
|
|
|
|
/* FACEBOOK ROUTER */
|
|
|
|
|
router.get('/facebook', passportFacebook.authenticate('facebook'));
|
|
|
|
|
|
|
|
|
|
<<<<<<< HEAD
|
|
|
|
|
|
|
|
|
|
///////////////////
|
|
|
|
|
router.get('/facebook/callback',
|
|
|
|
|
passportFacebook.authenticate('facebook', { failureRedirect: 'api/' }),
|
|
|
|
|
function(req, res) {
|
|
|
|
|
console.log('faceeeeboookk !!');
|
|
|
|
|
=======
|
|
|
|
|
router.get('/facebook/callback', passportFacebook.authenticate('facebook', { successRedirect : '/', failureRedirect: '/login' }), function(req, res) {
|
|
|
|
|
>>>>>>> 98b837065bd51764d8da85c7972979c9fcf214dc
|
|
|
|
|
// Successful authentication, redirect home.
|
|
|
|
|
res.redirect('/api/main');
|
|
|
|
|
});
|
|
|
|
|
<<<<<<< HEAD
|
|
|
|
|
// router.get('/facebook/callback/:id', passport.authenticate('facebook'), function(req, res, err, user, info){
|
|
|
|
|
// console.log('faceeeeboookk !!');
|
|
|
|
|
//
|
|
|
|
@ -348,27 +356,49 @@ router.get('/facebook/callback',
|
|
|
|
|
// router.get('/facebook',
|
|
|
|
|
// passportFacebook.authenticate('facebook', { scope: ['read_stream', 'publish_actions'] })
|
|
|
|
|
// );
|
|
|
|
|
=======
|
|
|
|
|
router.get('/facebook',
|
|
|
|
|
passport.authenticate('facebook', { scope: ['read_stream', 'publish_actions'] })
|
|
|
|
|
);
|
|
|
|
|
>>>>>>> 98b837065bd51764d8da85c7972979c9fcf214dc
|
|
|
|
|
|
|
|
|
|
/* GOOGLE ROUTER */
|
|
|
|
|
router.get('/google', passportGoogle.authenticate('google', { scope: 'https://www.google.com/m8/feeds' }));
|
|
|
|
|
|
|
|
|
|
router.get('/google/callback', passportGoogle.authenticate('google', { successRedirect : '/', failureRedirect: '/login' }), function(req, res) {
|
|
|
|
|
<<<<<<< HEAD
|
|
|
|
|
res.redirect('/');
|
|
|
|
|
});
|
|
|
|
|
router.get('/google',
|
|
|
|
|
passport.authenticate('google', { scope: ['read_stream', 'publish_actions'] })
|
|
|
|
|
);
|
|
|
|
|
=======
|
|
|
|
|
res.redirect('/');
|
|
|
|
|
});
|
|
|
|
|
router.get('/google',
|
|
|
|
|
passport.authenticate('google', { scope: ['read_stream', 'publish_actions'] })
|
|
|
|
|
);
|
|
|
|
|
>>>>>>> 98b837065bd51764d8da85c7972979c9fcf214dc
|
|
|
|
|
|
|
|
|
|
/* GITHUB ROUTER */
|
|
|
|
|
router.get('/github', passportGitHub.authenticate('github', { scope: [ 'user:email' ] }));
|
|
|
|
|
|
|
|
|
|
router.get('/auth/github/callback', passportGitHub.authenticate('github', { successRedirect : '/', failureRedirect: '/login' }), function(req, res) {
|
|
|
|
|
<<<<<<< HEAD
|
|
|
|
|
// Successful authentication, redirect home.
|
|
|
|
|
res.redirect('/');
|
|
|
|
|
});
|
|
|
|
|
router.get('/github',
|
|
|
|
|
passport.authenticate('github', { scope: ['read_stream', 'publish_actions'] })
|
|
|
|
|
);
|
|
|
|
|
=======
|
|
|
|
|
// Successful authentication, redirect home.
|
|
|
|
|
res.redirect('/');
|
|
|
|
|
});
|
|
|
|
|
router.get('/github',
|
|
|
|
|
passport.authenticate('github', { scope: ['read_stream', 'publish_actions'] })
|
|
|
|
|
);
|
|
|
|
|
>>>>>>> 98b837065bd51764d8da85c7972979c9fcf214dc
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
module.exports = router;
|
|
|
|
|