Passport strategy for authenticating with Line access tokens using the OAuth 2.0 API. Based on Line Social API v2.1
$ npm install --save passport-line-token
var LineTokenStrategy = require('passport-line-token');
passport.use(new LineTokenStrategy({
clientID: LINE_CHANNEL_ID,
clientSecret: LINE_CHANNEL_SECRET,
}, function(accessToken, refreshToken, profile, done) {
User.findOrCreate({lineId: profile.id}, function (error, user) {
return done(error, user);
});
}
));
Use passport.authenticate()
, specifying the 'line-token'
strategy, to authenticate requests.
app.post('/auth/line/token',
passport.authenticate('line-token'),
function (req, res) {
// do something with req.user
res.send(req.user? 200 : 401);
}
);
- passport-facebook-token
- passport-line-auth passport line strategy for web server
- Line Socail Api