Cypress + MSAL Angular Authentication Redirect Issue – Need Guidance #33454
praveenazm
started this conversation in
General
Replies: 1 comment
-
|
See https://docs.cypress.io/app/guides/authentication-testing/azure-active-directory-authentication If that does not help, then you may get better feedback by asking your question in the Cypress technical community on Discord. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am encountering an issue while automating an Angular-based portal that utilizes MSAL Angular (@azure/msal-angular) for Microsoft (Azure AD) authentication. Here's the scenario:
I'm using Cypress for end-to-end automation. When I click on "Sign in with Microsoft," it correctly redirects to the Microsoft login page. After entering the credentials successfully, the application redirects back to the portal, and the dashboard loads briefly. However, immediately after, the app redirects back to the login screen. Essentially, the flow is:
Login succeeds → Dashboard loads → Immediate redirect back to login.
Additional context:
It appears that MSAL’s getAllAccounts() or setActiveAccount() is not retaining the session state after the redirect. What I am trying to understand is:
My goal is to keep authentication as part of the end-to-end process, avoid redirect loops, and prevent session loss after login.
Any insights, patterns, or recommended approaches/workarounds would be greatly appreciated.
Beta Was this translation helpful? Give feedback.
All reactions