Login when authentication is done on a 3rd party server.
The app server app_server.js runs on port 7074 and the auth server auth_server.js runs on port 7075. File cypress/e2e/logging-in-single-sign-on-spec.cy.js describes the overall authentication flow and implements tests that follow it.
The tests show how to:
- Login when authentication is done on a 3rd party server.
- Automatically parse tokens using
cy.request()
and set as cookies - Manually set tokens on local storage (similar to SPA flow).
- Map external hosts like
auth.corp.com:7075
and point to local servers127.0.0.1:7075
in cypress.config.js - Get the authentication token just once and set it before each test (should make tests faster)
tip to start the server and run Cypress GUI use script npm run dev
Highly recommended: watch video "Organizing Tests, Logging In, Controlling State"
To see debug logs from the server, run the server with DEBUG=sso