Authenticate Auth0 using cypress with in-browser cross domain login

Viewed 146

I am trying to log into my app using Cypress. The flow is...

  • A user visits my site
  • I notice they are not authenticated
  • I redirect them to auth0 to authenticate
  • Auth0 sends me a code via callback and they are redirected back to the page

When I try this flow with the following Cypress code...

const fillLogin = async () => {
  cy.log("Filling login");
  cy.get("#username")
    .should("be.visible")
    .type(testUser());
  cy.get("#password")
    .should("be.visible")
    .type(testPassword());
  cy.get("button[name=\"action\"]")
    .should("be.visible")
    .click();

  return cy.get(".main-container")
    .should("be.visible");
};

Everything works until it gets ready to redirect back to the /callback and it just freezes. The url it gets stuck on is /authorize/resume?state=....

I think it might be because the authentication is in a domain other than the actual webapp domain.

0 Answers
Related