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

Insecure Http cookies don't work on Chrome #656

Open
joshmedeski opened this issue Oct 5, 2021 · 1 comment
Open

Insecure Http cookies don't work on Chrome #656

joshmedeski opened this issue Oct 5, 2021 · 1 comment

Comments

@joshmedeski
Copy link
Contributor

Describe the bug

  1. If COOKIE_SECURE="true" on localhost development, I can not test on Safari
  2. If COOKIE_SECURE="false" on localhost development, I can not test on Chrome

To Reproduce
Steps to reproduce the behavior:

  1. Log in to the application
  2. Reload the browser to trigger refresh logic
  3. User won't be logged back in (http cookie doesn't exist)

Expected behavior
I expect to be able to test functionality across multiple browsers on local development.

Screenshots
Screen Shot 2021-10-05 at 11 32 08 AM

Desktop (please complete the following information):

  • OS: macOS
  • Browser Chrome
  • Version 94.0.4606.61

Comments
I'm guessing there's some security setting on one of the browsers that needs to be changed so I can test http-only cookies across multiple browsers.

@elitan
Copy link
Contributor

elitan commented Oct 5, 2021

This is most likely due to browsers blocking third party cookies. You can confirm that it's the case if you enable third-party cookies: https://support.cloudhq.net/how-to-enable-3rd-party-cookies-in-google-chrome-browser/

I'd recommend saving the refresh token in localStorage instead. Use cookie: false when register and logging in to receive the refresh token as part of the body.

https://github.com/nhost/nhost-js-sdk/blob/9d3d34c29e4c078abb591fcdc96eee4728c2e5f6/src/Auth.ts#L161-L171

https://github.com/nhost/nhost-js-sdk/blob/9d3d34c29e4c078abb591fcdc96eee4728c2e5f6/src/Auth.ts#L570-L574

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

2 participants