Node.js & Express session problem

前端 未结 4 2001
闹比i
闹比i 2020-12-28 09:06

I\'m having a problem with sessions, where sometimes the session variable I just set is undefined on the next page request. I typically have to go through the flow

4条回答
  •  情书的邮戳
    2020-12-28 09:25

    I filed an issue against Express about github, but figured out what was wrong a few minutes later. Not sure if you're having the same problem, but for completeness:

    In my case, I was testing by going to http://localhost:8003 but the OAuth provider was redirecting to http://hostname:8003. Same box/server/webpage, but different domain names means the browser sends different cookies and consequently, express gets different session ids and session data. As soon as I started testing at http://hostname:8003, everything worked just fine.

提交回复
热议问题