With Cypress 10, the cy.origin module can be used to visit multiple domains in the same test, which facilitates SSO automation. The Cypress OTP library can generate codes for MFA, and the combination of both can automate SSO with Office 365 with MFA enabled.
With single sign-on (SSO), users may securely log in to a number of different applications and websites with just one set of credentials.
A robust identity and access management (IAM) policy must incorporate MFA as a crucial component. MFA requires one or more additional verification methods besides a username and password, reducing the risk of successful cyberattacks.
1. Cypress 10 installed. 2. The secret key for Office 365 account. 3. And one npm package. To get more solution visit our below link.
You can use above npm command to install - npm i cypress-otp
Create a file named 'beforeafter.js' in the Cypress folder and paste the code for creating a session. The code is a custom command called in the command.js file which passes email, password and secret key as parameters. The session is restored to quickly authenticate and log in to the application.
We are successfully able to automate login to the application through SSO and automate MFA and reduce the login time using a session in Cypress. Here is a link to another good read around the same topic.