Skip to content

Instantly share code, notes, and snippets.

@gustavodemari
Created January 15, 2015 00:30
Show Gist options
  • Save gustavodemari/5344b6673faa014f7b42 to your computer and use it in GitHub Desktop.
Save gustavodemari/5344b6673faa014f7b42 to your computer and use it in GitHub Desktop.
Imprimir dados de profile do Facebook com Passport
//http://passportjs.org/guide/facebook/
var passport = require('passport')
, FacebookStrategy = require('passport-facebook').Strategy;
passport.use(new FacebookStrategy({
clientID: FACEBOOK_APP_ID,
clientSecret: FACEBOOK_APP_SECRET,
callbackURL: "http://www.example.com/auth/facebook/callback"
},
function(accessToken, refreshToken, profile, done) {
console.log(profile); //Imprimir dados do profile
User.findOrCreate(..., function(err, user) {
if (err) { return done(err); }
done(null, user);
});
}
));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment