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

Microsoft Entra authentication with Blazor server

$
0
0

I have created a blazor server application and I am using MicrosoftIdentity to authenticate the user.When I have serverprerender in _Host.cshtml it works perfectly. But does not work when I make it just server.

// Add services to the container.builder.Services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)    .AddMicrosoftIdentityWebApp()    .EnableTokenAcquisitionToCallDownstreamApi(initialScopes)    .AddMicrosoftGraph(builder.Configuration.GetSection("DownstreamApi"))    .AddInMemoryTokenCaches(); // apis

If the user is not logged in the app redirects the browser to this addresshttps://localhost:7106/MicrosoftIdentity/Account/SignIn

which again redirects to Microsoft login page.

But when I set rendering mode from "serverprerenderd" to "server"https://localhost:7106/MicrosoftIdentity/Account/SignIn this does not forward the browser to MS login page and just displays that there is not content in this page.


Viewing all articles
Browse latest Browse all 4839

Trending Articles



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