Open Closed

ExternalProviderSettingsHelper after upgrade to 9.2.3 from 9.0.4 not working #9700


User avatar
0
sghorakavi@cpat.com created
  • Steps to reproduce the issue: UPgraded project from 9.0.4 to 9.2.3 version of Volo. We had Helper override methods for class "ExternalProviderSettingsHelper". We need them to save tenant specific external login settings. GetByNameAsync(string name, bool fallBackToHost = false) and public override async Task SetAsync(List<ExternalProviderSettings> settings) not working now. Please help.

66 Answer(s)
  • User Avatar
    0
    sghorakavi@cpat.com created

    Can we work with current DB by clearing few tables. That will be easy for us to debug.

    The project is http://dev.approach.cpat.dev and http://cpattest.dev.approach.cpat.dev

    • I will send you email with Shared_TMSExternalProviderSettingsHelper class, that worked in 9.0.4 but does not work in 9.2.3 version.
    • Removed this code in above build. [AbpSettings] table has data but read is not working I can send you logs. Thank you
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    You can remove all settings of Abp.Account.ExternalProviders,Then add them in your setting page again.

    After that, everything will work.

    Because the template project is no problem.

    Thanks.

  • User Avatar
    0
    sghorakavi@cpat.com created

    Should I remove from table as well ? I removed the Shared_TMSExternalProviderSettingsHelper : IExternalLoginProvider class.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Yes, remove setting values from database and your custom class.

    Remember clear redis.

    Add new external login info again.

    Thanks

  • User Avatar
    0
    sghorakavi@cpat.com created

    We have public class CustomLoginModel : LoginModel in the Auth server it is referring to ExternalProviders. base class still needs ExternalProviders reference. Should I remove CustomLoginModel class ? CustomLoginModel is referred in Login.cshtml

    Deleted table data and removed the Shared_TMSExternalProviderSettingsHelper class. I couldn't remove CustomLoginModel.cs due to existing dependencies, as mentioned earlier. The database records have now been cleaned and the Redis cache cleared. Result: -The tenant is no longer able to read external provider data. :-( -Host admin can read external provider data fine.

    DB does NOT look right: Now the save is not working after clearing cache.

    Tenant UI:

    Select Save->switch to Audit Logs->Switch back to settings.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    If you need, you can inject the ExternalProviderSettingsHelper service.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Can you test your case in a new template project?

    The logic here are:

    • If your tenant setting values are the same as the host, the tenant setting will be empty. But the external login feature will no problem.
    • The host and the tenant can enable external login separately.
    • Host: Enable/disable external logins and control which external logins can be used by tenants
    • Tenant: Enable/disable the external login the host allows it to use.
  • User Avatar
    0
    sghorakavi@cpat.com created

    [maliming] said:

    Where should I inject ExternalProviderSettingsHelper service ?

    I emailed you the code of Shared_TMSExternalProviderSettingsHelper class. I deleted that class in the 9.2.3 upgrade project,

  • User Avatar
    0
    sghorakavi@cpat.com created

    [maliming] said: hi

    Can you test your case in a new template project?

    The logic here are:

    • If your tenant setting values are the same as the host, the tenant setting will be empty. But the external login feature will no problem.
    • The host and the tenant can enable external login separately.
    • Host: Enable/disable external logins and control which external logins can be used by tenants
    • Tenant: Enable/disable the external login the host allows it to use.

    Let me try this now.

  • User Avatar
    0
    sghorakavi@cpat.com created

    [sghorakavi@cpat.com] said:

    [maliming] said: hi

    Can you test your case in a new template project?

    The logic here are:

    • If your tenant setting values are the same as the host, the tenant setting will be empty. But the external login feature will no problem.
    • The host and the tenant can enable external login separately.
    • Host: Enable/disable external logins and control which external logins can be used by tenants
    • Tenant: Enable/disable the external login the host allows it to use.

    Let me try this now.

    With template project, I have issue to login as tenant.:

    -Logged in to host - Created external login separate option -- Created tenant -Login to tenant from host admin getting below error.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi Try to use dotnet run command to start your web app.

  • User Avatar
    0
    sghorakavi@cpat.com created

    [maliming] said: hi Try to use dotnet run command to start your web app.

    same error with dotnet run command for web:

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    The new website port is 44396

    Please use the website url.

  • User Avatar
    0
    sghorakavi@cpat.com created

    [maliming] said: The new website port is 44396

    Please use the website url.

    Login button goes there:

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Please use dotnet run command to start all websites.

    Thanks

  • User Avatar
    0
    sghorakavi@cpat.com created

    yes, dotnet run for all services is working. I see the 9.2 version added ![image.png]. How can I add that to current project which is migrating from 9.0.4 :

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    You need to remove your custom Shared_TMSExternalProviderSettingsHelper and clear the setting value of Abp.Account.ExternalProviders

    Then upgrade to 9.3.x. Everything will work.

    Thanks..

  • User Avatar
    0
    sghorakavi@cpat.com created

    [maliming] said: hi

    You need to remove your custom Shared_TMSExternalProviderSettingsHelper and clear the setting value of Abp.Account.ExternalProviders

    Then upgrade to 9.3.x. Everything will work.

    Thanks..

    • I removed Shared_TMSExternalProviderSettingsHelper class,
    • cleared tables. Reset data seed.

    Note: We have a class CustomLoginModel : LoginModel. This class has reference to Volo.Abp.Account.ExternalProviders.

    Injecting IAccountExternalProviderAppService

    It is AuthServer\Pages\Account\CustomLoginModel.cs Location. How should I handle this class?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Please share your CustomLoginModel code.

    liming.ma@volosoft.com

    Thanks

  • User Avatar
    0
    sghorakavi@cpat.com created

    [maliming] said: liming.ma@volosoft.com

    Sent you pls check

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Your CustomLoginModel won't affect the ExternalProviderSettingsHelper.

    You can continue to keep it.

    Thanks.

  • User Avatar
    0
    sghorakavi@cpat.com created

    [maliming] said: hi

    Your CustomLoginModel won't affect the ExternalProviderSettingsHelper.

    You can continue to keep it.

    Thanks.

    In that case, http://dev.approach.cpat.dev has that code. // It gets SSO fine

    Please check http://cpattest.dev.apprch.cpat.dev //Does not save SSO information for Extrernal Login

    The code is not failing but NOT saving tenant specific external provider data:

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    How can I reproduce this locally?

    Can you share the code?

    Thanks

  • User Avatar
    0
    sghorakavi@cpat.com created

    Added following in HostModule.cs

    private static void ConfigureExternalProviders(ServiceConfigurationContext context) { context.Services .AddDynamicExternalLoginProviderOptions<PingOneAuthenticationOptions>( PingOneAuthenticationDefaults.AuthenticationScheme, // (options, serviceProvider, tenantId) => options => { options.WithProperty(x => x.ClientId); options.WithProperty(x => x.ClientSecret, isSecret: true); options.WithProperty(x => x.AuthorizationEndpoint); options.WithProperty(x => x.TokenEndpoint); options.WithProperty(x => x.UserInformationEndpoint); } ) .AddDynamicExternalLoginProviderOptions<MicrosoftAccountOptions>( MicrosoftAccountDefaults.AuthenticationScheme, options => { options.WithProperty(x => x.AuthorizationEndpoint); options.WithProperty(x => x.TokenEndpoint); options.WithProperty(x => x.ClientId); options.WithProperty(x => x.ClientSecret, isSecret: true); } ); }

    AuthServer Module has following for external login

    context.Services.AddAuthentication() .AddPingOne(options => { // Common options options.SaveTokens = true; options.SignInScheme = IdentityConstants.ExternalScheme; options.EnvironmentId = "Dynamic"; options.CallbackPath = "/signin-pingone"; // read tenant specific data //scope options.Scope.Add("openid"); options.Scope.Add("profile"); options.Scope.Add("offline_access"); }).WithDynamicOptions<PingOneAuthenticationOptions, PingOneAuthenticationHandler>( "PingOne", options => { options.WithProperty(x => x.ClientId); options.WithProperty(x => x.ClientSecret, isSecret: true); options.WithProperty(x => x.AuthorizationEndpoint); options.WithProperty(x => x.TokenEndpoint); options.WithProperty(x => x.UserInformationEndpoint); } ) .AddMicrosoftAccount(MicrosoftAccountDefaults.AuthenticationScheme, options => { //Personal Microsoft accounts as an example. options.AuthorizationEndpoint = "https://login.microsoftonline.com/consumers/oauth2/v2.0/authorize"; options.TokenEndpoint = "https://login.microsoftonline.com/consumers/oauth2/v2.0/token"; options.ClaimActions.MapCustomJson("picture", _ => "https://graph.microsoft.com/v1.0/me/photo/$value"); options.SaveTokens = true; }) .WithDynamicOptions<MicrosoftAccountOptions, MicrosoftAccountHandler>( MicrosoftAccountDefaults.AuthenticationScheme, options => { options.WithProperty(x => x.TokenEndpoint); options.WithProperty(x => x.AuthorizationEndpoint); options.WithProperty(x => x.ClientId); options.WithProperty(x => x.ClientSecret, isSecret: true); } );

    I will try to create a sample but pls review code above. Is there a way to put some logs for you to debug ?

    Thank you

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Can you share your test project so I can reproduce it?

    Thanks.

Learn More, Pay Less
33% OFF
All Trainings!
Get Your Deal
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.0.0-preview. Updated on September 12, 2025, 10:20