const express = require('express');
const router = express.Router();
const { Email } = require('../models/email.model');
const { User } = require('../models/user.model');
const nodemailer = require('nodemailer');

const passport = require('passport');
const  FacebookStrategy  = require('passport-facebook').Strategy;

passport.use(new FacebookStrategy({
    clientID: "318954999682335",
    clientSecret: "9f8d5261decefbaf556f4c42539ee358",
    callbackURL: "http://localhost:4000/api/auth/facebook/callback",
    enableProof: false
  },
 
  (accessToken, refreshToken, profile, done) => {
   try{
    console.log('acces token ',accessToken);
    console.log('refresh token ',refreshToken);
    console.log('profile ',profile);
    console.log('done ',done);
}  catch(error){
   console.log(error)
}
    
  }
));


router.get('/', passport.authenticate('facebook' ) );
router.get('/callback',  passport.authenticate('facebook',
 { successRedirect: '/profile',
  failureRedirect: '/'}
  ));


module.exports = router; 