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

Blazor Server using MSAL auth. Error connecting to API: Cannot provide a value for property 'downstreamAPI'

$
0
0

I'm in a world of pain here. For weeks now I've simply being trying to use AD B2C or Entra to provide authentication for my Blazor and Maui apps and my secure API. I tried to set up a Blazor Server app in the following way:

  1. Create new ASP.NET Core Web API project in VS 2022. Select .NET 8, authentication "Microsoft Identity Platform" and let VS set it all up.

  2. Create new Blazor Server app in .NET 7. Select the same Entra tenant etc that was created in the previous step. Select that I want to use the above API project. Let VS set it all up.

  3. When I run these two projects, I can log in to the Blazor Server app using my Microsoft details but when I call the API I get this:

System.InvalidOperationException: Cannot provide a value for property 'downstreamAPI'on type 'Kae.BlazorServer4.Pages.CallWebApi'. There is no registered service of type 'Microsoft.Identity.Web.IDownstreamWebApi'.

Now I know roughly what this error means. There's a problem with dependency injection and it can't find this type. But I can't figure out how to fix it. Surely these templates should work out of the box? What am I doing wrong here?


Viewing all articles
Browse latest Browse all 4839

Trending Articles



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