passport-lyft
v0.1.2
Published
Lyft authentication strategy for Passport
Downloads
2
Maintainers
Readme
Passport-lyft
Passport strategy for authenticating with Lyft using the OAuth 2.0 API.
This module lets you authenticate using Lyft in your Node.js Express (or Connect) server applications.
Install
$ npm install passport-lyft
Usage
Configure Strategy
The Lyft authentication strategy authenticates users using an Lyft account and OAuth 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.
var lyftStrategy = require('passport-lyft').Strategy;
passport.use(new lyftStrategy({
clientID: LYFT_CLIENT_ID,
clientSecret: LYFT_CLIENT_SECRET,
callbackURL: 'http://localhost:3000/callback',
state: true
},
function(accessToken, refreshToken, profile, done) {
var user = profile;
user.accessToken = accessToken;
return done(null, user);
}
));
Authenticate Requests
Use passport.authenticate()
, specifying the 'lyft'
strategy, to authenticate requests.
For example, as route middleware in an Express application:
app.get('/auth/lyft',
passport.authenticate('lyft', { scope: ['public','profile'] }
));
app.get('/callback', passport.authenticate('lyft', { failureRedirect: '/login' }),
function(req, res) {
res.redirect('/');
});
License
Copyright (c) 2016 Tomomi ❤ Imura <http://girliemac.com>