Open Closed

How does SSO bind or unbind an existing account #8688


User avatar
0
464199480 created

It's not just the frame itself

For example, https://account.abp.io/, I want to log in through Google or Twitter and bind my own account, but the account name already exists.

I also want to unbind the associated SSO account and re-bind it

This feature helps to increase the functionality of the website

Although I can implement it myself, if the framework itself implements it, I don't have to maintain it myself

Hope the abp team can pay attention to it

Thanks


12 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    ABP already supports this

    https://abp.io/docs/latest/modules/account-pro#manage-external-logins

  • User Avatar
    0
    464199480 created

    Hi

    Which version to use?

    I used when 9.0.0 to create an empty template, but no Account External Provider

    The template has confirmed that SSO is enabled

      context.Services.AddAuthentication()
          .AddGoogle(GoogleDefaults.AuthenticationScheme, options =>
          {
              options.ClaimActions.MapJsonKey(AbpClaimTypes.Picture, "picture");
          })
          .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.
              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.ClientId);
                  options.WithProperty(x => x.ClientSecret, isSecret: true);
              }
          )
          .AddTwitter(TwitterDefaults.AuthenticationScheme, options =>
          {
              options.ClaimActions.MapJsonKey(AbpClaimTypes.Picture, "profile_image_url_https");
              options.RetrieveUserDetails = true;
          })
          .WithDynamicOptions<TwitterOptions, TwitterHandler>(
              TwitterDefaults.AuthenticationScheme,
              options =>
              {
                  options.WithProperty(x => x.ConsumerKey);
                  options.WithProperty(x => x.ConsumerSecret, isSecret: true);
              }
          );
    
  • User Avatar
    0
    464199480 created

    I seem to have spotted the issue

    I create this via abp new Acme.Demo-u angular

    Angular templates do not appear to have external login associations

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    I can't reproduce the problem.

    Version(9.0.3)

    My steps

    • abp new Qa8688 -u angular
    • Create database migration and run projects

  • User Avatar
    0
    464199480 created

    External providers have come out

    I used 9.0.4

    But there is still no documentation of external logins

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    You need to enable an external provider first.

  • User Avatar
    0
    464199480 created

    I confirm that the external provider is enabled

    But still not displayed

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    I can't reproduce the problem

  • User Avatar
    0
    464199480 created

    Angular environment that can be reproduced

    const oAuthConfig = {
      issuer: 'http://localhost:44372/',
      redirectUri: baseUrl,
      clientId: 'BookStore_App',
      responseType: 'password', // change to password
      scope: 'offline_access BookStore',
      requireHttps: false,
      impersonation: {
        userImpersonation: true,
        tenantImpersonation: true,
      },
    };
    
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Currently, the angular password flow does not support external login.

  • User Avatar
    0
    464199480 created

    Got it

    Is binding to existing username not currently supported when logging in via SSO?

    Need to log in with a username for SSO binding?

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Currently, manual binding of social accounts is supported only after user login.

    Like this.

Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
Do you need assistance from an ABP expert?
Schedule a Meeting
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v9.2.0-preview. Updated on March 13, 2025, 04:08