Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Tokens not stored in session if cookie is set to be secure: false #105

Open
franciscohanna92 opened this issue Nov 18, 2020 · 0 comments
Open

Comments

@franciscohanna92
Copy link

Tokens are not stored in session after successful login if the cookie for express-session is set to be secure: false. If I set it to true, then the cookies are not sent to the server because I'm on localhost and over HTTP.

Is this the expected behavior? Is the only solution to run it over HTTPS? I've tried to use self signed certificates for HTTPS, but Chrome says the site is insecure and the cookies are not sent.

Expected behavior

The tokens are stored in the session even if the cookie is set to be secure: false

Actual behavior

The tokens are not stored in the session (only the user id)

Steps to reproduce

  1. Set the cookie to be secure: false
  2. Trigger the OAuth flow
  3. After redirect to callback finishes, check the sesion stored on the database: No tokens found.
  4. Change the cookie to be secure: true
  5. Trigger the OAuth flow
  6. After redirect to callback finishes, check the sesion stored on the database: Tokens are present.

Environment

Ubuntu 20.04
Node v12.16.2
passport@0.4.1
passport-twitter@1.0.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant