lecture 6 of 160 completed

SSO, OAuth and the same-origin wall

Enterprise auth is where Cypress most often blocks a team. Here is what works, what does not, and how to decide.

What you'll learn

  • Why SSO breaks the same-origin rule
  • When to use cy.origin and when to authenticate by API
  • How to cover the real flow without slowing every test

This is the topic that generates the most "Cypress cannot do this" conversations in real companies, and most of them are half right. Here is the full picture.

Why it is hard. Your app is at app.company.com. Sign-in redirects the browser to login.okta.com. That is a different origin, and Cypress's test code is page code bound by the browser's same-origin policy. When the browser leaves your origin, your test cannot reach the page it lands on.

This is the architecture lecture's fact three, arriving in your sprint.

members only

Keep reading with the full course

The Foundations track and the first 5 lectures of each framework are free. This lecture is part of the paid course, which unlocks every lecture, all three frameworks, and downloads.

See the options →