@kenote/koa-passport
TypeScript icon, indicating that this package has built-in type declarations

1.0.32 • Public • Published

@kenote/koa-passport

Passport plug-in based on Koa for Kenote.js.

NPM Version NPM Downloads Gratipay

Usage

index.ts

import { Module, ServerFactory } from '@kenote/core'
import { ServiceEngine } from '@kenote/koa'
import session from '@kenote/koa-session'
import redisStore from 'koa-redis'
import passportPlugin from '@kenote/koa-passport'
import passport from 'koa-passport'
import { Strategy } from 'passport-local'

// Add Strategy
passport.use(new Strategy(
  (username, password, done) => {
    return done(null, { username })
  }
))

@Module({
  imports: [],
  plugins: [
    session({
      store: redisStore(),
    }),
    passportPlugin()
  ],
})
class AppModule {}

async bootstarp () {
  let factory = await ServerFactory(new ServiceEngine()).create(AppModule)
  factory.server.listen(4000)
}

MIT License.

Readme

Keywords

Package Sidebar

Install

npm i @kenote/koa-passport

Weekly Downloads

0

Version

1.0.32

License

MIT

Unpacked Size

11.6 kB

Total Files

16

Last publish

Collaborators

  • thondery