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


8 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

Made with ❤️ on ABP v9.2.0-preview. Updated on January 23, 2025, 12:17