Open Closed

I want to add external Idsrv4 to the abp Idsrv - * **ABP Framework version:** commercial v 5rc.1 #2265


User avatar
0
mostafa_ibrahem22@hotmail.com created
  • ABP Framework version: commercial v 5rc.1

  • UI type: Angular

  • DB provider: EF Core

  • Tiered (MVC) or Identity Server Separated (Angular): yes

I want to add external Idsrv4 to the abp Idsrv
In Project "XXXX.IdentityServer.csproj"
I added two Packages
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="6.0.0" />
<PackageReference Include="IdentityModel" Version="5.1.0" />

and I configure authentication, but still user can not login,

    context.Services.AddAuthentication()
            .AddJwtBearer(options =>
            {
                options.Authority = configuration["AuthServer:Authority"];
                options.RequireHttpsMetadata = Convert.ToBoolean(configuration["AuthServer:RequireHttpsMetadata"]);
                options.Audience = configuration["AuthServer:ApiName"];
            }).AddOpenIdConnect("oidc", options =>
            {
                options.Authority = "https://localhost:44382/";
                options.ClientId = "main_core_idsrv";
                options.ClientSecret = "main_core_idsrv_secret_mvc";
                options.ResponseType = OpenIdConnectResponseType.Code;
                options.SaveTokens = true;
                options.GetClaimsFromUserInfoEndpoint = true;   
                options.TokenValidationParameters = new TokenValidationParameters
                {
                    ValidateAudience = false
                };
                options.Scope.Clear();
                options.Scope.Add("openid");
                options.Scope.Add("profile");
                options.Scope.Add("ApiOne");
                options.Scope.Add("offline_access");
                options.Events = new OpenIdConnectEvents
                {
                    OnTokenValidated = context =>
                    {
                        var userID = context.Principal.FindFirstValue("sub");
                        return Task.CompletedTask;
                    }};
            });

image.png => click OpenIdConnect button

image.png => login in external ids4

image.png => return to code to check every thing OK

image.png => still login page apper


19 Answer(s)
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 v9.3.0-preview. Updated on June 10, 2025, 08:13