const router = require('express').Router();
const passport = require('passport');
// auth login
router.get('/login', (req, res) => {
res.render('login', { user: req.user });
});
// auth logout
router.get('/logout', (req, res) => {
// handle with passport
res.send('logging out');
});
// auth with google
router.get('/google',passport.authenticate('google',{
scope:['email']
}));
router.get('/google/redirected',passport.authenticate('google',{
successRedirect:"/",
failureRedirect:"/login"
}),(req,res)=>{
res.send('Redirected Successfully !')
})
module.exports = router;
GooglePlusAPIError: Legacy People API has not been used in project 297453248242 before or it is disabled. Enable it by visiting