1.0.2 • Published 7 years ago

passport-nextengine v1.0.2

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

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.

  1. Login nextengine
  2. Click アプリを作る
  3. Input required information and callback uri in test environment
  4. 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 .

License

The MIT License