passport-wrike
v0.0.2
Published
Wrike authentication strategy for Passport.
Downloads
5
Maintainers
Readme
Passport-Wrike
Passport strategy for authenticating with Wrike using the OAuth 2.0 API.
Install
$ npm install passport-wrike
Usage
Configure Strategy
The Wrike authentication strategy authenticates users using a Wrike
account and OAuth 2.0 tokens. The strategy requires a verify
callback, which
accepts these credentials and calls done
providing a user, as well as
options
specifying a client ID, client secret, and callback URL.
passport.use(new WrikeStrategy({
clientID: CLIENT_ID,
clientSecret: CLIENT_SECRET,
callbackURL: "/auth/wrike/callback"
},
function(accessToken, refreshToken, profile, done) {
User.findOrCreate({ 'wrike.id': profile.id }, function (err, user) {
return done(err, user);
});
}
));
Authenticate Requests
Use passport.authorize()
, specifying the 'Wrike'
strategy, to
authenticate requests.
For example, as route middleware in an Express application:
app.get('/auth/wrike',
passport.authorize('wrike'));
app.get('/auth/wrike/callback',
passport.authorize('wrike', { successRedirect: '/',
failureRedirect: '/login' }));
Thanks
License
Copyright (c) 2015 Lucas Monteverde <http://github.com/lucasmonteverde>