Wunderlist OAuth 2.0 authentication strategy for Passport.
This module lets you authenticate using Wunderlist in your Node.js applications. By plugging into Passport, OAuth 2.0 authentication can be easily and unobtrusively integrated into any application or framework that supports Connect-style middleware, including Express.
$ npm install passport-wunderlist
The Wunderlist authentication strategy authenticates users using a Wunderlist
account and OAuth 2.0 tokens. The provider's OAuth 2.0 endpoints, as well as
the client identifer and secret, are specified as options. The strategy
requires a verify
callback, which receives an access token and profile,
and calls cb
providing a user.
passport.use(new WunderlistStrategy({
clientID: EXAMPLE_CLIENT_ID,
clientSecret: EXAMPLE_CLIENT_SECRET,
callbackURL: "http://localhost:3000/auth/example/callback"
},
function(accessToken, refreshToken, profile, cb) {
User.findOrCreate({ exampleId: profile.id }, function (err, user) {
return cb(err, user);
});
}
));
Use passport.authenticate()
, specifying the 'wunderlist'
strategy, to
authenticate requests.
For example, as route middleware in an Express application:
app.get('/auth/example',
passport.authenticate('wunderlist'));
app.get('/auth/example/callback',
passport.authenticate('wunderlist', { failureRedirect: '/login' }),
function(req, res) {
// Successful authentication, redirect home.
res.redirect('/');
});
Copyright (c) 2017 Bram Pellens <http://www.brampellens.be/>