aksoftware98 / blazor-webapp-microsoft-identity-auth

.NET 8.0 template for Blazor Web App project setup with Microsoft Identity Platform authentication.
MIT License
7 stars 1 forks source link

Authenticate a Downstream API #1

Open lockhartsoftware opened 4 months ago

lockhartsoftware commented 4 months ago

Excellent code, as usual. Thank you.

Can you please help on how I could extend this approach to Authenticate with a Downstream ASP.NET 8.0 Web API?

aksoftware98 commented 4 months ago

Hi @lockhartsoftware Thank you for great feedback!!

Very great question, just for further clarification, you need to send a an API request from your Blazor Web App to another API that authenticates with the same app registration but different scope? is that correct?

lockhartsoftware commented 4 months ago

Hi @aksoftware98

Yes, that's absolutely correct.

The scenario I have in mind is:

What do you think? Is there a better way to do this?

I can't seem to find any sample code for achieving that with the latest .NET 8.0 Blazor Server-side Render Web App.

aksoftware98 commented 4 months ago

Yeah brilliant got what you mean 100% And yes that's completely possible. I will modify the repo to add a sample with Downstream API call sample with token acquisition and caching.

In the meantime, check this link, hopefully it will be help you. A web app that calls web APIs: Code configuration

I will keep this issue opened until the example is added to the repo,

Let me know if you have any other questions

lockhartsoftware commented 4 months ago

Wow, thank you so much. I’ve been struggling with that for ages.

aksoftware98 commented 4 months ago

So happy that helped, I will also simplify the project event more so it can be directly implemented in the template through a command or something. Thank for helping make this package better.