-
Notifications
You must be signed in to change notification settings - Fork 676
Does not render the application when using MSAL for login. #4834
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I have previously raised a bug for having a loop when logging in with |
I was able to reproduce the issue. I confirm that without TestCafe, the app works and with TestCafe - there is a blank page. Could you please clarify whether you have problems only if you use the |
@AlexKamaev, However, we are moving away from |
The reason we are moving away is I dont know if the login loop problem will be present once we move to |
At this moment it's difficult to say why your scenario stopped working. We need to research it in detail. |
Good morning @AlexKamaev. Would you be able to suggest a work around to make the tests run until a fix is ready - our e2e tests are blocked at the moment as we cannot authenticate |
We don't have a workaround for this behavior yet. |
Hey @AlexSkorkin, how is the plan going to address this bug? |
Hi @zsid, we cannot provide any estimates at this time. |
hello, I have example of application which successfully logging in user on localhost please try to reproduce it locally (not in codesandbox.io) and make some resolution |
@kerosan, Thank you for the additional information. |
Is there any ETA bug fix? |
@taruntomar-qa, |
Also seing issues on testing our React SPA app with MSAL.js authentication. I am evaluating TestCafe for providing end-to-end application. We are using Azure AD B2C as the authentication provider. We have a automatic redirect to the login page and also endup into infinite loop, so pretty similar to #4754, but we are using msal.js version 1.4.0 and seing this problem. We have our own implementation of getting the MSAL to work with react app instead of using If needed I could provide another example to reproduce the issue with, I think. |
I could also provide some more details after a quick study. I am not very deep into the way MSAL.js works, but can maybe provide some insight. Firstly we are using the implicit grant flow (the only one Azure AD B2C works with currently) and that still locks us down to MSAL.js 1.x instead of the new 2.0. Getting the authentication to work with MSAL.js without problems was quite a hassle, but some help from Microsoft and looking into the github issues got us past those (when running manually). So first of all the implicit grant flow seems to rely on page being redirected to the redirect address usually being the same as the SPA app it self and the MSAL.js somehow picks up the details of the authenctication from the URL params. To me it seems that currently that phase is failing as after the redirect I am not seeing the access token as I am supposed to. So what doest TestCafe do in this case? Also while I do not understand the tricks TestCafe does to make things work, I would also like to note that if Azure B2C is not able to mathc redirect URL being configured (e.g. https://localhost:3000/authRedirect) to the list of approved redirect urls configured to it, then it resorts to redirecting to one of the URL's on its approved list it seems. |
It seems that with TestCafe anything relying on Also relying on |
Hello @aviita, Thank you for reaching out to us.
TestCafe modifies DOM and prefixes URLs with a service part. Requests are then proxied by
With TestCafe your application should interact with a browser API the same way as without it, i.e., you can rely on |
Ok. I will check the 1.3.0, but I did check 1.3.4 already actually with no difference in behaviour. In the meantime I noticed that there had been another update to MSAL.js and a followup bug (2370) on that, so yes the MSAL.js is not all that robust in it self. That is why I am so happy it is finally working withuout issues (in regular use). So while the MSAL.js is bit shaky it is the pricing model and other features Azure AD B2C that makes it such a good fit for us that there is currenly no way to back out from that. That is why we might go with another testing tool, we can be sure does not get into trouble with the auth setup. Anyways I would like to assist in fixing this issue, here is a github gist with the auth code that shares the logic the app works with in regards to this authentication. Note that code in it self does not comile as such, since e.g. the StaticAsset defined by NSwag based on our REST API is missing. Also if you want to reproduce this, can you setup your own Azure B2C tenant or do you need help in that regard? One needs to have the application (in B2C) configured for SPA app with implicit grant flow to make this code work. Additionally as code comments show there needs to be this one scope configured for Read.All. |
@aviita, Thank you for your assistance. We will look into the example you shared. I would like to one more time draw your attention to this solution), which may help you resolve the issue. |
@arubtsov, I guess I forgot to mention that I did run all my test runs with |
Thank you for the additional information. We started to research the issue, however, we cannot give any estimates on this.
Thank you for the cooperation. We will let you know if we need further assistance. |
We researched the issue and are working on a fix. For the team: Storage wrappers (for localStorage and sessionStorage) don't save changes in native storages if these changes take place after the
|
this issue is same what i am having with my application. it does not redirect to my the application |
The original issue was fixed in DevExpress/testcafe-hammerhead#2473 |
What is your Test Scenario?
I am replacing
react-adal
toreact-aad-msal
. Cannot see the application rendered once I have logged in.What is the Current behavior?
Does not render my application in tests
What is the Expected behavior?
Renders my application in tests
What is your web application and your TestCafe test code?
I have created a repo with instructions how it can be replicated - https://github.com/zsid/testcafe-azure-ad
The text was updated successfully, but these errors were encountered: