Passport strategy for authenticating with Beatport using the OAuth 1.0 API.
$ npm install passport-beatport
var BeatportStartegy = require('passport-beatport').Strategy;
passport.use(new BeatportStartegy({
consumerKey: EXAMPLE_CONSUMER_KEY,
consumerSecret: EXAMPLE_CONSUMER_SECRET,
callbackURL: 'https://www.example.net/auth/beatport/callback'
},
function(token, tokenSecret, profile, done) {
User.findOrCreate(..., function (err, user) {
done(err, user);
});
}
));
Use passport.authenticate()
, specifying the 'beatport'
strategy, to
authenticate requests.
For example, as route middleware in an Express application:
app.get('/auth/beatport',
passport.authenticate('beatport'));
app.get('/auth/beatport/callback',
passport.authenticate('beatport', { failureRedirect: '/login' }),
function(req, res) {
// Successful authentication, redirect home.
res.redirect('/');
});
Copyright (c) 2013 Jakub Jelen