Azure-Samples / ms-identity-javascript-angular-spa-aspnetcore-webapi

An Angular single-page application that authenticates users with Azure AD and calls a protected ASP.NET Core web API using MSAL Angular
74 stars 32 forks source link

PKCE Error with MSAL and Angular App #37

Closed dmccolloughOneGas closed 3 years ago

dmccolloughOneGas commented 3 years ago

Please follow the issue template below. Failure to do so will result in a delay in answering your question.

Library

Description

We have a angular 10 application that we have developed that is using MSAL.

We are in the process of trying to deploy it to our Qual environment for user acceptances testing.

The Azure Administrator has added the SPA url for our qual website (Example: https://somefunwebsite-q.domain.com)

The Angular app has been compiled with ng build --prod and deployed to the front end servers.

When we try and browse to the application in Chrome, if you look at the console. we are getting this error: ERROR Error: Uncaught (in promise): BrowserAuthError: pkce_not_created: The PKCE code challenge and verifier could not be generated. Detail:TypeError: Cannot read property 'digest' of undefined BrowserAuthError: pkce_not_created: The PKCE code challenge and verifier could not be generated. Detail:TypeError: Cannot read property 'digest' of undefined

This did not occur in our lower environments, dev or test.

What is wrong and how do I correct it?

dmccolloughOneGas commented 3 years ago

Ok, this is a load balancing issue on our part. if the user goes to port 80 you get the error, if they go to port 443 (SSL) it works fine.