Does MSAL 2.0 only work with SPA websites?

W, Glenn 20 Reputation points
2023-05-10T15:13:34.0133333+00:00

So I'm trying to move an html, CSS, javascript web site from using ADAL to MSAL 2.0. It is not a SPA. Can I use MSAL without making the website a SPA? I've tried for the last three days to get MSAL to work, but it keeps redirecting back to my index.html page and when I try to force it to another page it redirects back to my index page and it is an endless loop. So should I just not bother and continue to use ADAL until we can build a new version of the site as a SPA (maybe a year timeframe to do so.)?

Thanks for any feedback

Glenn

Microsoft Security | Microsoft Entra | Microsoft Entra ID
0 comments No comments
{count} votes

Accepted answer
  1. Vahid Ghafarpour 23,385 Reputation points Volunteer Moderator
    2023-05-10T18:36:52.1733333+00:00

    Yes, you can use MSAL on a non-SPA website. MSAL supports both SPA and non-SPA web applications.

    It sounds like the issue you're experiencing with the endless loop may be due to incorrect configuration or usage of MSAL. It's important to ensure that your redirect URI is correctly configured in your MSAL application registration in Azure Active Directory. Additionally, you should check that the scopes you are requesting are appropriate for your application.

    To help with troubleshooting, you can enable verbose logging in MSAL. This will provide additional details about the authentication flow and may help you identify the root cause of the issue.

    Overall, it's recommended to migrate from ADAL to MSAL as ADAL is being deprecated. However, if you're unable to get MSAL working in a reasonable amount of time, it may be worth considering continuing to use ADAL until you're able to build a new version of the site as a SPA.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.