passport-nextengine
Nextengine authentication strategy for Passport and Node.js.
Install
$ npm install passport-nextengine
Usage
Create nextengine application
At first, you must create new application.
- Login nextengine
- Click
アプリを作る
- Input required information and callback uri in test environment
- Copy
クライアントID
(client id) andクライアントシークレット
(client secret)
Register strategy
const NextengineStrategy = require('passport-nextengine').Strategy
passport.use(new NextengineStrategy({
clientId: 'YOUR_CLIENT_ID',
clientSecret: 'YOUR_CLIENT_SECRET',
// redirectUri: 'YOUR_REDIRECT_URI'
}, (user, done) => {
done(null, user)
}))
Authenticate
app
// POST /auth/nextengine
.use(route.post('/auth/nextengine',
passport.authenticate('nextengine')
))
// GET /auth/nextengine/callback
.use(route.get('/auth/nextengine/callback',
passport.authenticate('nextengine', {
failureRedirect: '/',
successRedirect: '/dashboard'
})
))
For more details, please see Example application .