Optional AzureAD login when using .Net Core Identity

Hello all,

I am not sure if this is the correct category for this question so apologies if it isn't.

I have created a Blazor Server app (.Net 9 - through Radzen blazor studio) and I am using the .Net Core Identity framework for security.

I would like to add the ability for a user to click and use AzureAD as an extra option. I realize you cannot do this through the interface, I'm attempting it manually.

I have been able to configure the necessary services in Program.cs and register an app in Azure, and I have been able to verify that I do got out to a Microsoft login page, then return back to the app, successfully getting information (e.g. claims) in the return.

Unfortunately, this is as far as I have gotten, the application doesn't recognise a successful login and HttpContext.User.Identity.IsAuthenticated is always false.

So before posting bits of code or debug text, I want to ask has anyone else tried to do the same, and introduce an optional alternative login to an app that already has Identity in use?

Is it possible to actually do this?

Me and my single remaining strand of hair would appreciate any advice or suggestions.

Brett.

Hi Brett,

I think your topic is unrelated to Radzen Studio, but you can get that working by following the steps in this document:

We have managed to configure that in multiple of our web apps.

Cheers!

Hi pepito007,

Thank you for your response.

I placed the topic in this category as I was unsure which was most appropriate, but I created the web app in Studio. Sorry for any confusion.

I'll take a look at that link and attempt to get the functionality working, hopefully I'll have a positive update in the coming days.

Brett.

Hello all,

A very quick update on this.

Using the linked document provided by pepito007, I was able to integrate Microsoft Login with my web app, so credit to pepito007.

I have been left with one problem, I am unable to get the app role associated with the user, but that is a topic for elsewhere.

Brett.

Hey Brett, I face the same problem - I'm using Azure to Authenticate, but want to use asp.net identity for roles etc.

Do you have any useful code you could share?