using FilterCair.Client; using FilterCair.Client.Services; using FilterCair.Client.Services.API; using Microsoft.AspNetCore.Components.Web; using Microsoft.AspNetCore.Components.WebAssembly.Authentication; using Microsoft.AspNetCore.Components.WebAssembly.Hosting; var builder = WebAssemblyHostBuilder.CreateDefault(args); builder.RootComponents.Add("#app"); builder.RootComponents.Add("head::after"); builder.Services.AddHttpClient("FilterCair.ServerAPI", client => client.BaseAddress = new Uri(builder.Configuration["Api:BaseUrl"] ?? "https://localhost:7010")) .AddHttpMessageHandler(); builder.Services.AddScoped(sp => sp.GetRequiredService().CreateClient("FilterCair.ServerAPI")); builder.Services.AddMsalAuthentication(options => { builder.Configuration.Bind("AzureAd", options.ProviderOptions.Authentication); options.ProviderOptions.DefaultAccessTokenScopes.Add( "api://54b010c7-4a9a-4f2d-bea3-9faba3f12495/API.Access"); }); //Services builder.Services.AddScoped(); //API Services builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); await builder.Build().RunAsync();