var passport = require('passport');
var GitHubStrategy = require('passport-github').Strategy;

passport.use(new GitHubStrategy({
        clientID: "60a0296da9fce6ca3b7e",
        clientSecret: "9fb2f52123d9d840c98b98b3b4ffbc5dd77d1de3",
        callbackURL: "https://localhost:3000/api/github/callback"
    },
    function(accessToken, refreshToken, profile, done) {
        User.findOrCreate({userid: profile.id}, {name: profile.displayName,userid: profile.id}, function (err, user) {
            return done(err, user);
        });
    }
));

module.exports = passport;
