Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

incorrect session for backend route #523

Closed
nikrb opened this issue Nov 12, 2017 · 3 comments
Closed

incorrect session for backend route #523

nikrb opened this issue Nov 12, 2017 · 3 comments

Comments

@nikrb
Copy link

nikrb commented Nov 12, 2017

first up, as a nuub, apologies if I am presenting a red herring here.

maybe similar to #520 and #515 ... have provided a repo as requested so you can hopefully clone and run to see the issue.
Repo is here and instructions are in README.md on local-prod-test branch.
Server code is here

expected behaviour

  1. Click "authed?" button - response user not authenticated (in console)
  2. Click "twitter login" link. Authorize app (and return)
  3. Click "authed?" button - response user is authenticated (in console)

actual behaviour

  1. Click "authed?" button - response user not authenticated (in console)
  2. Click "twitter login" link. Authorize app (and return)
  3. Click "authed?" button - response user is not authenticated (in console)

Node Version 6.11.2
Express Version 4.13.3
Session Version 1.15.6

The debug output shows the session is not correct and querying mongo before and after
clicking "authed?" button show a new session created each time.

@dougwilson
Copy link
Contributor

Hi @nikrb thanks for the information! I'll need to get MongoDB setup to take a look, but even then, I don't really see you doing any interaction with this module directly in your code, to see if there is anything obviously wrong. Are you use this isn't a bug somewhere else, like with the Passport module? If you think it's a bug in this module and not in Passport, can you please slim down your example to make it easier to debug by removing the use of Passport and just use this module directly?

@dougwilson
Copy link
Contributor

show a new session created each time

Usually this would mean that you're not sending the session cookie with the requests to the server, so as far as the server knows, there is no session to load and creates a new one. Can you verify if the session cookie is in your browser's cookie jar and that whatever your client code is is sending the cookie to the browser? If you are making cross-domain requests or using the latest browser fetch stuff, I believe there is something you have to set in your client code to include cookies in your requests or something.

@nikrb
Copy link
Author

nikrb commented Nov 13, 2017

you're not sending the session cookie with the requests

thanx for your time and the explanation. You're right of course ... after a quick search I found how to send the cookie using fetch.

@nikrb nikrb closed this as completed Nov 13, 2017
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants