Open
Description
Current behavior
It seems like Cypress is unable to re apply cookies set for the base domain after redirect from an different origin.
I found that while testing a typical OAuth authorization code flow. It requires at some point for the server to store a challenge (aka code) in session to then use it to verify the params when the identity provider calls back the server. In my case, the session is a encrypted cookie and while it works while manually testing I can not get this test to pass with Cypress.
Desired behavior
When the external domain wrapped in cy.origin
redirects to the base domain, the request should contain the cookies for the base domain.
Test code to reproduce
it.only("can sign in with SSO", () => {
cy.visit("/login?sso");
const username = () => $t("username-input");
const submit = () => $t("sign-in-button");
username().find("input").type("{selectall}me@example.com");
// this triggers a session creation (set-cookie) and redirects to onelogin.com
submit().click();
cy.origin("xxx.onelogin.com", () => {
cy.get("#password").type("xxx{enter}");
// Now onelogin.com redirects to my domain /auth/callback but somehow the
// session cookie is not in the headers. This results in the failure of
// the callback parameters check.
});
// This fails because the server redirected to the login page instead to
// restart the process.
cy.url().should("contain", "/home");
});
Cypress Version
13.12.0
Node version
22
Operating System
macOS 14.5
Debug Logs
No response
Other
No response