Passport strategy for authenticating with Lately using the OAuth 2.0 API.
This module lets you authenticate using Lately in your Node.js Express (or Connect) server applications.
$ npm install passport-lately
The Lately authentication strategy authenticates users using a Lately 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 LatelyStrategy = require('passport-lately').Strategy;
passport.use(new LatelyStrategy({
clientID: Lately_CLIENT_ID,
clientSecret: Lately_CLIENT_SECRET,
callbackURL: 'http://localhost:3000/callback',
state: true
},
function(accessToken, refreshToken, profile, done) {
var user = profile;
user.accessToken = accessToken;
return done(null, user);
}
));
Use passport.authenticate()
, specifying the 'lately'
strategy, to authenticate requests.
For example, as route middleware in an Express application:
app.get('/auth/lately',
passport.authenticate('lately', { scope: ['lately:user/profile','lately:content/generate'] }
));
app.get('/callback', passport.authenticate('lately', { failureRedirect: '/login' }),
function(req, res) {
res.redirect('/');
});
Copyright (c) 2018 Lately Inc. <https://trylately.com>