Name: koa-passport
Owner: egg
Description: Passport middleware for Koa
Forked from: rkusa/koa-passport
Created: 2017-02-17 15:21:38.0
Updated: 2017-11-06 16:06:49.0
Pushed: 2017-01-30 08:27:43.0
Size: 87
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Passport middleware for Koa
koa-passport version | koa version | branch | npm tag ——————— | ————| —— | ——- 1.x | 1.x | v1.x | latest 2.x | 2.x | v2.x | next 3.x | 2.x | master |
3.0.0-rc.3
ctx.passport.*
to ctx.state.*
(e.g. ctx.passport.user
to ctx.state.user
)ctx.req
(e.g. use ctx.login
instead of ctx.req.login
)err, user, info, status
(e.g. passport.authenticate('local', function(err, user, info, status) { ... })(ctx, next)
)ody parser
t bodyParser = require('koa-bodyparser')
use(bodyParser())
essions
t convert = require('koa-convert') // necessary until koa-generic-session has been updated to support koa@2
t session = require('koa-generic-session')
keys = ['secret']
use(convert(session()))
t passport = require('koa-passport')
use(passport.initialize())
use(passport.session())
Passport's values and methods are exposed as follows:
use(async ctx => {
x.isAuthenticated()
x.isUnauthenticated()
x.login()
x.logout()
x.state.user