Passport-twitter: failed to find request token in session

This is a very late answer, but I just figured another reason this can happen. When the guys who made express-session said that MemoryStore is not meant for production, they really meant it.

If you're using clustering, (pm2 or forever or running on Heroku), then memory based cookie storages have their own set of problems. You'll often loose cookies or corrupt them (because there are two or more separate processes on server side, not sharing common memory).

If you want to run your Node app with clusters, you need to use Redis or some DB-backed cookie storage


I also encountered this error using Node.js, Express & Passport, although my fix was different than those described above.

I had copied and pasted the following code from the 'express-session' documentation...

app.use(session({ secret: 'keyboard cat', key: 'sid', cookie: { secure: true }}))

That secure: true bit instructs express-session to use 'https', which I don't have setup in my development environment. Once I removed it, the error went away.


YUHU I solved. the problem was that some times my website had www and sometimes not, so there were problems with sessions, apparently.