Skip to content

bpellens/passport-wunderlist

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

passport-wunderlist

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.

Install

$ npm install passport-wunderlist

Usage

Configure Strategy

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);
    });
  }
));

Authenticate Requests

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('/');
  });

License

The MIT License

Copyright (c) 2017 Bram Pellens <http://www.brampellens.be/>

About

Wunderlist authentication strategy for Passport

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published