Passport strategy for development environment.
This module lets you replace your passport strategies in development for mocked responses without having to reconfigure your application routes. By plugging into Passport, local authentication can be easily and unobtrusively integrated into any application or framework that supports Connect-style middleware, including Express.
$ npm install passport-dev
The dev authentication strategy authenticates using a mocked data object which simulates the response obtained by the production provider.
if (process.env.NODE_ENV == 'production' ) {
passport.use(new TwitterStrategy({
consumerKey: TWITTER_CONSUMER_KEY,
consumerSecret: TWITTER_CONSUMER_SECRET,
callbackURL: "http://127.0.0.1:3000/auth/twitter/callback"
},
function(token, tokenSecret, profile, done) {
User.findOrCreate({ twitterId: profile.id }, function (err, user) {
return done(err, user);
});
}
));
} else {
var DevStrategy = require('passport-dev');
passport.use(new DevStrategy('twitter', {
user: '@marcosnils',
email: '[email protected]'
}));
}
$ npm install
$ npm test