rkusa/koa-passport

Deserialization in Assets

nahtnam opened this issue · 2 comments

Hey,

I am having a problem where passport is deserializing on every single request, even requests to static assets like fonts and stylesheets. Is there any way to stop it? It feels like its a waste of a few sql statements.

Thanks.

rkusa commented

I might have to put app.use(passport()) after app.use(static()) in your middleware stack.

So

app.use(static())

app.use(passport.initialize())
app.use(passport.session())

and not

app.use(passport.initialize())
app.use(passport.session())

app.use(static())

Does this help?

Ah I see. That makes sense. I will do that.