change ctx.passport.* to ctx.state.* (e.g. ctx.passport.user to ctx.state.user)
don't call passport methods on ctx.req (e.g. use ctx.login instead of ctx.req.login)
update custom authentication callback arguments to err, user, info, status (e.g. passport.authenticate('local', function(err, user, info, status) { ... })(ctx, next))
Usage
// body parserconstbodyParser=require('koa-bodyparser')app.use(bodyParser())// Sessionsconstsession=require('koa-session')app.keys=['secret']app.use(session({},app))constpassport=require('koa-passport')app.use(passport.initialize())app.use(passport.session())
请发表评论