Open Closed

azure AD integration Issue #7043


User avatar
0
s.alshammari.c created

HI , I am using asp and angular I am trying to integrate Azure AD for Authentication.

 private void ConfigureAuthentication(ServiceConfigurationContext context, IConfiguration configuration)  
{  
JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Clear();  
JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Add("sub", ClaimTypes.NameIdentifier);  
context.Services.AddAuthentication()  
  
.AddAzureAD(options => configuration.Bind("AzureAd", options));

context.Services.Configure<OpenIdConnectOptions>(AzureADDefaults.OpenIdScheme, options =>  
{  
options.Authority = "[https://login.microsoftonline.com/"](https://login.microsoftonline.com/%22 "https://login.microsoftonline.com/%22") + configuration["AzureAd:TenantId"] + "/v2.0/";  
options.ClientId = configuration["AzureAd:ClientId"];  
options.CallbackPath = configuration["AzureAd:CallbackPath"];  
options.ResponseType = OpenIdConnectResponseType.CodeIdToken;  
options.RequireHttpsMetadata = false;

options.TokenValidationParameters.ValidateIssuer = false;  
options.GetClaimsFromUserInfoEndpoint = true;  
options.SaveTokens = true;  
options.SignInScheme = IdentityConstants.ExternalScheme;

options.Scope.Add("email");  
options.ClaimActions.MapJsonKey(ClaimTypes.NameIdentifier, "sub");

});  
}

I get the following errors

Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

9 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    This doesn't seem to be an abp problem. Can you test your code in a plain ASP Net core app?

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    s.alshammari.c created

    openid configrations are correct but i get this error .

    swagger is work fine. the issue with angular

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Http failure response

    Please check the browser console/network panel to see if there are any messages.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    s.alshammari.c created

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Can you share the logs.txt ?

    liming.ma@volosoft.com

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    s.alshammari.c created

    i sent to your email

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Do you have code like below in your FormsHttpApiHostModule?

    If so can you share the steps to reproduce this error in a new angular and aspnet core template app?

    context.Services.AddCors(options =>
    {
        options.AddDefaultPolicy(builder =>
        {
            builder
                .WithOrigins(
                    configuration["App:CorsOrigins"]?
                        .Split(",", StringSplitOptions.RemoveEmptyEntries)
                        .Select(o => o.Trim().RemovePostFix("/"))
                        .ToArray() ?? Array.Empty<string>()
                )
                .WithAbpExposedHeaders()
                .SetIsOriginAllowedToAllowWildcardSubdomains()
                .AllowAnyHeader()
                .AllowAnyMethod()
                .AllowCredentials();
        });
    });
    

    app.UseCors();

    
    app.UseStaticFiles();
    app.UseRouting();
    app.UseCors();
    
    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    s.alshammari.c created

    yes I have the code like the one you sent.

    I don't know how to reproduce the problem .

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Can you share a simple project to reproduce?

    Thanks

    liming.ma@volosoft.com

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.8.0-preview. Updated on October 05, 2026, 11:32
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.