Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Blazor using Azure Active Directory B2C: "the app is unable to listen on the specified URL"

$
0
0

I have a .NET 8 Blazor Web App running in Server Interactive rendering mode. I'm using AD B2C MSAL for authentication. I'm connecting to a secure API. This works fine locally but when I deploy to Azure I get this error:

MSAL.NetCore.4.64.1.0.MsalClientException:    ErrorCode: http_listener_errorMicrosoft.Identity.Client.MsalClientException: An HttpListenerException occurred while listening on http://localhost:52140/ for the system browser to complete the login. Possible cause and mitigation: the app is unable to listen on the specified URL; run 'netsh http add iplisten 127.0.0.1' from the Admin command prompt. ---> System.Net.HttpListenerException (5): Access is denied.

The error is raised at this line in the code:

PCA = PublicClientApplicationBuilder    .Create(_settings?.ClientId)    .WithB2CAuthority(_settings?.Authority)    .WithRedirectUri("http://localhost")    .Build();

I'm using code from this repo:https://github.com/carlfranklin/MsalAuthInBlazor

I've been stuck on this problem for more than a week and it's really doing my head in. I have searched the Internet for solutions. I have checked all the AD configuration many times. I've tried many different redirect URIs. I've checked Tenant and Client IDs etc. I have to admit that I have trouble understanding how all this works and how to diagnose this problem. Does anyone know how to approach this issue?


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>