-
Notifications
You must be signed in to change notification settings - Fork 3.3k
cy.getCookies() Does Not Return Cookies Whose Domain Does Not Correspond with baseUrl #8956
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
Comments
I found the same problem for Seems like a security issue almost. What if I want to test my code on localhost but with a backend running somewhere else? I can then easily get these kinds of problems. |
is there any workaround to get all existing cookies in all domains? |
Sorry for the bump, it's been a while. Any chance this bug can be addressed? Checking for cookies form other domains is critical to several areas, including security, analytics, and authentication. What's stopping this issue moving forward? |
For everyone here looking for a work-around, it looks like this trick from the
Would love a more "official" API/solution, but this worked for me. |
The code for this is done in cypress-io/cypress#25012, but has yet to be released. |
Released in This comment thread has been locked. If you are still experiencing this issue after upgrading to |
Current behavior
cy.getCookies()
returns only the cookies whose domain matches that ofbaseUrl
.Desired behavior
cy.getCookies()
should return all cookies, regardless of their domain.Test code to reproduce
With the
baseUrl
set to"https://cypress.io"
, run the following test:cy.getCookies()
returns only the cookies whose domain ends incypress.io
. The cookie ending indifferent.io
is missing.If
baseUrl
ishttps://different.io
instead, then onlycookie3
is returned.Versions
Cypress version 5.4.0, Chrome 86, macOS 10.15.6.
The text was updated successfully, but these errors were encountered: