I encountered this issue in an ASP.NET Core Razor app with .NET 8.0. I was able to fix it by performing the following steps:
- Edit launchSetting.json and adding the web url under https --> applicationUrl
- Re-run the Connected Services --> Microsoft Identity Platform wizard from inside Visual Studio 2022. Create a new App Registration and link it.
The actions this wizard takes includes the missing step.