|
|
|
@ -11,25 +11,7 @@ module.exports = function(passport) {
|
|
|
|
|
var opts = {};
|
|
|
|
|
opts.jwtFromRequest = ExtractJwt.fromAuthHeaderWithScheme("jwt");
|
|
|
|
|
opts.secretOrKey = config.secret;
|
|
|
|
|
/*
|
|
|
|
|
passport.use(new FacebookStrategy({
|
|
|
|
|
clientID: "191092458179642",
|
|
|
|
|
clientSecret: "964e490d7e49a13ee7a77c9b65419fb3",
|
|
|
|
|
callbackURL: "http://localhost:3000/api/facebook/callback"
|
|
|
|
|
},
|
|
|
|
|
function(accessToken, refreshToken, profile, done) {
|
|
|
|
|
console.log('yaaauuu : ' + accessToken + ' ----- ' + profile.displayName);
|
|
|
|
|
|
|
|
|
|
User.findOrCreate({username: profile.displayName}, {username: profile.displayName, id: profile.id}, function(err, user) {
|
|
|
|
|
console.log('yaaauuu err : ' + ' ----- ' + err );
|
|
|
|
|
|
|
|
|
|
console.log('yaaauuu user : ' + ' ----- ' + JSON.stringify(user));
|
|
|
|
|
if (err) { return done(err); }
|
|
|
|
|
done(null, user);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
));
|
|
|
|
|
*/
|
|
|
|
|
passport.use(new JwtStrategy(opts, function(jwt_payload, done) {
|
|
|
|
|
|
|
|
|
|
User.findOne({id: jwt_payload.id, username: jwt_payload.username}, function(err, user) {
|
|
|
|
@ -45,9 +27,5 @@ module.exports = function(passport) {
|
|
|
|
|
done(null, false);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}));
|
|
|
|
|
};
|
|
|
|
|