Skip to content

Instantly share code, notes, and snippets.

@newz2000

newz2000/app.js Secret

Last active August 29, 2015 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save newz2000/5fc526ccd5279194490a to your computer and use it in GitHub Desktop.
Save newz2000/5fc526ccd5279194490a to your computer and use it in GitHub Desktop.
Enable passport
var passport = require('passport');
var TwitterStrategy = require('passport-twitter').Strategy;
var findOrCreateProfile = require('./findOrCreateProfile');
app.use(passport.initialize());
app.use(passport.session());
var Account = require('./models/account');
passport.use(new TwitterStrategy({
consumerKey: '...',
consumerSecret: '...',
callbackURL: ”http://localhost:3000/auth/twitter/callback"
},
function(token, tokenSecret, profile, done) {
findOrCreateProfile({twitterId: profile.id}, profile, done);
}
));
passport.serializeUser(Account.serializeUser());
passport.deserializeUser(Account.deserializeUser());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment