Open Closed

Not properly logging out of External Provider #1619


User avatar
0
KirstyLH created
  • UI type: Blazor
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): Tiered
  • Exception message and stack trace: N/A
  • Steps to reproduce the issue:"

We have a system with both local account and External Provider (Microsoft) login types enabled. When a user logs in to Blazor with a Microsoft account, and then logs out again, if they log in with the same browser then the Microsoft account is assumed and logged in automatically. There is no way to log in with a different Microsoft account without also entering a Microsoft app and logging out. We need the blazor logout to also log the Microsoft account out of the browser.

Is this a configuration issue?


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

    hi

    External Provider (Microsoft)

    Some external provider not supprot Logout eg Microsoft.AspNetCore.Authentication.MicrosoftAccount

    Can you share your provider package and related code?

  • User Avatar
    0
    KirstyLH created

    We are pretty much just using the built-in logout action. The only change we made was to alter the Microsoft endpoints to support business Microsoft accounts instead of personal ones. Everything seems to work except this less than complete logout.

    private void ConfigureExternalProviders(ServiceConfigurationContext context, IConfiguration configuration)
            {
                context.Services.AddAuthentication()
                    .AddGoogle(GoogleDefaults.AuthenticationScheme, _ => { })
                    .WithDynamicOptions<GoogleOptions, GoogleHandler>(
                        GoogleDefaults.AuthenticationScheme,
                        options =>
                        {
                            options.WithProperty(x => x.ClientId);
                            options.WithProperty(x => x.ClientSecret, isSecret: true);
                        }
                    )
                    .AddMicrosoftAccount(MicrosoftAccountDefaults.AuthenticationScheme, options =>
                    {
                        //Personal Microsoft accounts as an example.
                        var tenantId = configuration["ExternalProviders:Microsoft:TenantId"];
                        options.AuthorizationEndpoint = string.Format("https://login.microsoftonline.com/{0}/oauth2/v2.0/authorize", tenantId);
                        options.TokenEndpoint = string.Format("https://login.microsoftonline.com/{0}/oauth2/v2.0/token", tenantId);
                    })
                    .WithDynamicOptions<MicrosoftAccountOptions, MicrosoftAccountHandler>(
                        MicrosoftAccountDefaults.AuthenticationScheme,
                        options =>
                        {
                            options.WithProperty(x => x.ClientId);
                            options.WithProperty(x => x.ClientSecret, isSecret: true);
                        }
                    )
                    .AddTwitter(TwitterDefaults.AuthenticationScheme, options => options.RetrieveUserDetails = true)
                    .WithDynamicOptions<TwitterOptions, TwitterHandler>(
                        TwitterDefaults.AuthenticationScheme,
                        options =>
                        {
                            options.WithProperty(x => x.ConsumerKey);
                            options.WithProperty(x => x.ConsumerSecret, isSecret: true);
                        }
                    );
            }
    
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi KirstyLH

    AddMicrosoftAccount does not support Signout

  • User Avatar
    0
    ServiceBot created
    Support Team Automatic process manager

    This question has been automatically marked as stale because it has not had recent activity.

Made with ❤️ on ABP v9.1.0-preview. Updated on December 13, 2024, 06:09