-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Cookies not being sent in redirect in 3.5.0 #5432
Comments
Confirmed 3.5.0 also broke our SSO on multiple different auth types. Had to revert back to 3.4.1 |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
The logs in 3.5.0 (I have added
Around
|
The logs for 3.4.1, the same test "can authenticate with cy.request"
with more details around
|
@flotwig seems like a cookie is not being sent in 3.5.0 after redirect |
Can confirm: on our automated testing environment we had 30+ tests that succeeded. and used *After updating to 3.5.0 -> they all fail * |
There's a PR open to fix this here: #5455 |
Heads up for anyone else encountering this, until a patch comes out I'm working around this issue by manually iterating through the set-cookies array, parsing all the key/values out, and calling cy.setCookie(name, value, etcetc) on each cookie |
I can confirm, even with 3.6.0. The tests that pass in 3.4.1 (using cookies), all still fail in 3.6.0.. |
Released in |
Thanks @brian-mann. Should this issue be reopened until the issue is resolved? |
@brian-mann Same issue here so +1 on reopening. Tests with login fail on 3.6.0 and pass in 3.4.1. I see something about a release in 3.6.0 3 days ago, but when I download cypress again from https://docs.cypress.io/guides/getting-started/installing-cypress.html#Direct-download, I still get the 31st October version. Can this issue be reopened please? Thanks! |
Reopening since there are still some bugs with cookies + redirects. There is a PR open that should fix the issues people here are having: #5478 |
The code for this is done in cypress-io/cypress#5478, but has yet to be released. |
Released in |
@brian-mann I've tried the 3.6.1 version but still facing the same problem, so forced to stick to 3.4.1. We do a BE call that generates a url with jwt token that redirects us to the final url we can visit and start testing FE from there. https://hostname.com/somename/eyJhbetcetcSomeLongJwtToken In all versions after 3.4.1 something seems to happen to those jwt-urls so they're not valid and giving us a 504 when trying to visit them. The call to the BE in both cases gives us a 200 and produces a url. The only difference I've been able to spot is in the response headers when selecting that call in the left Cypress menu and looking into dev tools: Does this give any clues? Hope to hear back from you, many thanks! |
Hey @emijmker - In Cypress 3.6.1 we fixed some cookie issues. Specifically, cookie within a redirect would not always be set on the correct domain. Now, if you follow a redirect flow like this:
You'll end up with these cookies:
Since this isn't working for you, do you think you could clearly describe the expected redirect flow + final cookies that you expect to be set, like I've done above? That will enable me to create a test case that I can use to figure out why it's not working as you expect. |
Still not fixed for me either. Without a workaround, my authentication script still fails in 3.6.1. Cypress still appears to only process the first cookie in the set-cookie array. Everything works as expected in 3.4.1 The auth flow goes like this:
So what we should be left with after all the above is two cookies: token1 and auth token. What I get as of 3.5.0+ is just token1 (from the original get request) and no auth token. And we're not going outside our subdomain at any point so the cookies all have the same domain. Note: if I cy.visit('/account/login'), type the username and password in and submit the form, the redirect sets all the cookies correctly and lets cypress log in, this method has never stopped working. It's only doing it via cy.request that's failing. Hope this helps, let me know if there's anything else I can do :) |
I have similar issue authenticating using cy.request() too |
@pete-om Thanks a ton for sharing these details! I will get to work on reproducing this and tracking down the issue. These details are awesome. FYI, I moved your comment to an issue so we can track this more clearly, as this thread is getting messy. New issue: #5688 You might want to watch it to receive updates. |
I'm also still experiencing issues on 3.6.1... :/ |
Also experiencing issues on 3.6.1 Keep going back to 3.4.1 |
Should this be reopened? I can confirm it doesn't work in 3.6.1 but it works in 3.4.1 |
+1, also having issues on 3.6.1 |
#5688 is being used to track another known cookie bug in 3.6.1, the specific bug from this issue has been fixed. |
Current behavior:
I'm not sure what the issue is, but our Single Sign On Recipe is failing here: https://dashboard.cypress.io/#/projects/6p53jw/runs/32571/failures
Desired behavior:
The Single Sign On should log in and reroute to dashboard page.
Steps to reproduce: (app code and test code)
cypress
dependency to3.5.0
npm i
in root directorycd examples/logging-in__single-sign-on
npm start
npm run cypress:open
Smallest amount of code to run:
Versions
3.5.0
The text was updated successfully, but these errors were encountered: