Error from Azure Static Web site "npm install @azure/msal-angular": could not resolve dependency: peer rxjs@"^7.0.0" from @azure/msal-angular@3.0.8

Siegfried Heintze 1,721 Reputation points
2023-11-07T04:02:49.31+00:00

I have created an azure static web app using the vscode extension and selecting the angular flavor. I followed these instructions https://learn.microsoft.com/en-us/azure/static-web-apps/get-started-portal?tabs=angular&pivots=github

I would like to add Azure AD authentication to my new web site using this tutorial: https://learn.microsoft.com/en-us/entra/identity-platform/tutorial-v2-angular-auth-code#create-your-project

However, when I execute this step `npm install @azure/msal-browser @azure/msal-angular I get this error:


npm install @azure/msal-angular
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: angular-basic@0.0.0
npm ERR! Found: rxjs@6.6.7
npm ERR! node_modules/rxjs
npm ERR!   rxjs@"~6.6.6" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer rxjs@"^7.0.0" from @azure/msal-angular@3.0.8
npm ERR! node_modules/@azure/msal-angular
npm ERR!   @azure/msal-angular@"*" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! 
npm ERR! For a full report see:
npm ERR! C:\Users\shein\AppData\Local\npm-cache\_logs\2023-11-07T03_47_19_606Z-eresolve-report.txt
npm ERR! A complete log of this run can be found in: C:\Users\xxxxx\AppData\Local\npm-cache\_logs\2023-11-07T03_47_19_606Z-debug-0.log

How can I proceed with adding MSAL.js so I can implement authentication?

Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
626 questions
{count} votes

1 answer

Sort by: Most helpful
  1. VenkateshDodda-MSFT 14,206 Reputation points Microsoft Employee
    2023-11-07T05:36:22.97+00:00

    @Siegfried Heintze Thanks for reaching out to Microsoft Q&A, apologize for any inconvenience caused on this,

    Based on the shared information I have understand that you are trying to implement the Azure AD authentication in Azure static Apps.

    In Azure Static web Apps all the configurations like (Routing, Authentication, Authorization etc.,) should be defined in the staticwebapp.config.json file. Also, static web Apps supports both built-in authentication and custom identity provider authentication like (Microsoft Entra ID, Apple, Google etc.,).

    Refer to the below documentation for more information about configuring authentication in static webapps:

    1. Configure Built-In Authentication
    2. Configure Custom Authentication in static WebApps.
    3. Configure Authentication in Static WebApps using AzureAD B2C.

    Feel free to reach back to me if you have any further questions on this.