BEST
DEALS
OF THE
YEAR!
SAVE UP TO $3,000
24 NOV
1 DEC
00 Days
00 Hrs
00 Min
00 Sec
Open Closed

Cannot extend ExternalProviders list with WithDynamicOptions extension #5611


User avatar
0
raif created
  • ABP Framework version: v7.3.2
  • UI Type: MVC
  • Database System: EF Core SQL Server
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes
context.Services.AddAuthentication()
    //.AddAbpOpenIdConnect("myAuthSchema", "myAuth AD", options =>
    .AddOpenIdConnect("myAuthSchema", "myAuth AD", options =>
    {
        options.Authority = configuration["AzureAd:Authority"].EnsureEndsWith('/') + configuration["AzureAd:TenantId"].EnsureEndsWith('/') + "v2.0".TrimEnd('/');
        options.MetadataAddress = configuration["AzureAd:MetadataAddress"].EnsureEndsWith('/') + configuration["AzureAd:TenantId"].EnsureEndsWith('/') + "v2.0".EnsureEndsWith('/') + ".well-known/openid-configuration";
        options.ResponseType = OpenIdConnectResponseType.CodeIdToken;

        options.ClientId = configuration["AzureAd:ClientId"];
        options.ClientSecret = configuration["AzureAd:ClientSecret"];

        options.UsePkce = true;
        options.GetClaimsFromUserInfoEndpoint = true;

        options.TokenValidationParameters = new TokenValidationParameters()
        {
            ValidateIssuer = true,
        };

        options.TokenValidationParameters.ValidIssuers = new[]
        {
            configuration["AzureAd:MetadataAddress"],
            configuration["AzureAd:Authority"]
        };

        options.Scope.Add("openid");
        options.Scope.Add("profile");
        options.Scope.Add("offline_access");
        options.Scope.Add("email");
    });
    .WithDynamicOptions < OpenIdConnectOptions, OpenIdConnectHandler > (
        "myAuthSchema",
        options =>
        {
            options.WithProperty(x => x.ClientId);
            options.WithProperty(x => x.ClientSecret, isSecret: true);
        }
    );

I would like to provide ClientId and ClientSecret values via Account External Provider Settings

/api/account/external-provider endpoint keeps returning only Google, Twitter and Microsoft values

I also tried to extend provider list via AbpExternalProviderOptions but no luck

context.Services.Configure < AbpExternalProviderOptions > (options =>
{
    options.Definitions.Add(new ExternalProviderDefinition()
    {
        Name = "Test",
        Properties = new List < ExternalProviderDefinitionProperty >()
    });
});

What am i missing ?


2 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Fullstack Developer

    Hi,

    You need to configure AddDynamicExternalLoginProviderOptions in HttpApiHostModule module class

  • User Avatar
    0
    raif created

    Doh, thx

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.1.0-preview. Updated on November 20, 2025, 09:12
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.