rkusa/koa-passport

Use koa-passport without koa-session

walkerlangley opened this issue · 1 comments

Is it possible to use koa-passport without using koa-session? We've been using a much older version of koa-passport (1.3.0), aren't calling (app.use(passport.session()) and are able to authenticate users based off a jwt token passed in the header of a request. However, once I updated to the current version of koa-passport, the only way I can get authentication to work is if I also use koa-session. If I don't use koa-session, ctx.isAuthenticated() is always false. I've googled around and it se

Ok, may have solved the issue.

It seems that when vaildating the JWT token, I needed to call

ctx.state.user = user;
//Before we were calling
ctx.request.user = user;