Angular +.net core + Microsoft Identity

Discussão em 'Angular' iniciado por PhillyNJ, Dezembro 6, 2024.

  1. PhillyNJ

    PhillyNJ Guest

    I am trying to create a .net core (8.0) web site, that uses Angular (SPA) and Microsoft Identity. Basically, to access this site you must have a AD (Azure) login to access the site. I created the site with the below template:

    [​IMG]

    In program.cs I added

    app.UseAuthentication();


    But I am not getting the popup to login.

    I have configured Azure AD via the connected services and see the info in appsettings.json

    Here is my settings:

    var builder = WebApplication.CreateBuilder(args);

    builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
    .AddMicrosoftIdentityWebApi(builder.Configuration.GetSection("AzureAd"));

    // Add services to the container.

    builder.Services.AddControllers();
    // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
    builder.Services.AddEndpointsApiExplorer();
    builder.Services.AddSwaggerGen();

    var app = builder.Build();

    app.UseDefaultFiles();
    app.UseStaticFiles();

    // Configure the HTTP request pipeline.
    if (app.Environment.IsDevelopment())
    {
    app.UseSwagger();
    app.UseSwaggerUI();
    }

    app.UseHttpsRedirection();

    app.UseAuthorization();
    app.UseAuthentication();
    app.MapControllers();

    app.MapFallbackToFile("/index.html");

    app.Run();


    Any help is appropriated!

    Continue reading...

Compartilhe esta Página