Azure AD Authentication Security.User.Name is different to SSO logged in user

Hi everyone,

I have an issue with an Radzen Blazor Studio Server App with .Net 8 with Azure AD Authentication and which is deployed to an IIS v10.0 on Windows Server 2019.

We use Microsoft Edge on the client computer and Single Sign On into our Azure Account.
We cannot reproduce the issue but in some cases the value of the Security.User.Name in our app is different from the logged in user. After refreshing the page, the correct user is displayed. We thought about some cache issues on the IIS but getting the details of an user which was never logged in on this client computer is very strange and brings other problems with it.

Did someone has any idea, what happens here or had similar issues? If you need any additional information please let me know.

Thanks a lot in advance.

Pascal

Hi @PascalN,

You can try adding this line in the Program.cs file:

services.AddHttpClient("<YourAppName>")
        // --->
        .ConfigurePrimaryHttpMessageHandler(() => new HttpClientHandler { UseCookies = false })
        // <---
        .AddHeaderPropagation(o => o.Headers.Add("Cookie"));

There was an issue with cookie caching that could lead to similar issues.

Hi @korchev

I will try this. Thank you very much for the quick response and the solution.

Best,

Pascal