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

OpenIdConnect not working after deployment of blazor server app

$
0
0

The Blazor server application is working locally with a locally stored certificate. But the application is not working in the Azure portal, it keeps on showing pick an account dialogue. Application is registered in Microsoft Entra ID. Application is added as managed identity in keyvault access. Return URL is set in app registration.

This is program.cs

using CertificateAuth.Server.Components;using Microsoft.AspNetCore.Authentication.OpenIdConnect;using Microsoft.Identity.Web;using Microsoft.Identity.Web.UI;var builder = WebApplication.CreateBuilder(args);builder.Services.AddRazorComponents()    .AddInteractiveServerComponents()    .AddInteractiveWebAssemblyComponents();builder.Services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)    .AddMicrosoftIdentityWebApp(builder.Configuration.GetSection("AzureAd"))    .EnableTokenAcquisitionToCallDownstreamApi(new string[] { "User.Read", "User.Read.All" })    .AddMicrosoftGraph(builder.Configuration.GetSection("MicrosoftGraph"))    .AddInMemoryTokenCaches();builder.Services.AddControllersWithViews()    .AddMicrosoftIdentityUI();builder.Services.AddAuthorization(options =>{    options.FallbackPolicy = options.DefaultPolicy;});builder.Services.AddRazorComponents()    .AddInteractiveServerComponents();builder.Services.AddHttpContextAccessor();var app = builder.Build();// Configure the HTTP request pipeline.if (app.Environment.IsDevelopment()){    app.UseWebAssemblyDebugging();}else{    app.UseExceptionHandler("/Error", createScopeForErrors: true);    // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.    app.UseHsts();}app.UseHttpsRedirection();app.UseStaticFiles();app.UseAntiforgery();app.UseAuthentication();app.UseAuthorization();app.MapRazorComponents<App>()    .AddInteractiveServerRenderMode()    .AddInteractiveWebAssemblyRenderMode()    .AddAdditionalAssemblies(typeof(CertificateAuth.Client._Imports).Assembly);app.Run();

This is my appsettings.json for the deployed app

{"Logging": {"LogLevel": {"Default": "Information","Microsoft.AspNetCore": "Warning"    }  },"AllowedHosts": "*","AzureAd": {"Instance": "https://login.microsoftonline.com/","Domain": "xxxx.onmicrosoft.com","TenantId": "730237e0-xxxx-xxxx-xxxx-ccb0e9661c1e","ClientId": "df903d59-xxxx-xxxx-xxxx-b55c1c3db538","ClientCertificates": [      {"SourceType": "KeyVault","KeyVaultUrl": "https://kvxxxxx.vault.azure.net/","CertificateName": "certificateauthsample"      }    ],"ValidateAuthority": true,"CallbackPath": "/signin-oidc"  },"MicrosoftGraph": {"BaseUrl": "https://graph.microsoft.com/v1.0","Scopes": "User.Read.All"  }}

Viewing all articles
Browse latest Browse all 4839

Trending Articles



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