SocialLogin

TsgcHTMLComponent_SocialLogin — an OAuth social-login button panel (Google, Facebook, Apple, GitHub, Microsoft, Twitter, LinkedIn or custom) that builds each provider's authorization URL, in Delphi, C++ Builder and .NET.

TsgcHTMLComponent_SocialLogin

A button-panel component that emits one branded Bootstrap button per provider, each linking to that provider's OAuth 2.0 authorization endpoint. Add providers, pick a layout, then read the HTML property.

Component class

TsgcHTMLComponent_SocialLogin

Renders

Bootstrap 5 OAuth button panel

Languages

Delphi, C++ Builder, .NET

Add providers, render the panel

Call AddProvider for each provider with its client ID and redirect URI, set the Layout and divider, then read HTML. Each button links to the provider's authorization URL.

uses
  sgcHTML_Enums, sgcHTML_Component_SocialLogin;

var
  oSocial: TsgcHTMLComponent_SocialLogin;
begin
  oSocial := TsgcHTMLComponent_SocialLogin.Create(nil);
  try
    oSocial.Title := 'Sign in';
    oSocial.Subtitle := 'Choose your login method';
    oSocial.Layout := slVertical;
    oSocial.ShowDivider := True;
    oSocial.DividerText := 'or continue with';

    oSocial.AddProvider(spGoogle, 'GOOGLE_CLIENT_ID',
      'https://app.acme.com/oauth/google');
    oSocial.AddProvider(spGitHub, 'GITHUB_CLIENT_ID',
      'https://app.acme.com/oauth/github');

    WebModule.Response := oSocial.HTML;   // branded OAuth buttons
  finally
    oSocial.Free;
  end;
end;

// Each item can build its own authorization URL:
vURL := oSocial.Providers.Items[0].GetAuthorizationURL;
// includes: sgcHTML_Enums.hpp, sgcHTML_Component_SocialLogin.hpp

TsgcHTMLComponent_SocialLogin *oSocial = new TsgcHTMLComponent_SocialLogin(NULL);
try
{
  oSocial->Title = "Sign in";
  oSocial->Subtitle = "Choose your login method";
  oSocial->Layout = slVertical;
  oSocial->ShowDivider = true;
  oSocial->DividerText = "or continue with";

  oSocial->AddProvider(spGoogle, "GOOGLE_CLIENT_ID",
    "https://app.acme.com/oauth/google", "");
  oSocial->AddProvider(spGitHub, "GITHUB_CLIENT_ID",
    "https://app.acme.com/oauth/github", "");

  String html = oSocial->HTML;   // branded OAuth buttons

  // Each item can build its own authorization URL:
  String url = oSocial->Providers->Items[0]->GetAuthorizationURL();
}
__finally
{
  delete oSocial;
}
using esegece.sgcWebSockets;

var social = new TsgcHTMLComponent_SocialLogin();
social.Title = "Sign in";
social.Subtitle = "Choose your login method";
social.Layout = TsgcHTMLSocialLoginLayout.slVertical;
social.ShowDivider = true;
social.DividerText = "or continue with";

social.AddProvider(TsgcHTMLSocialProvider.spGoogle, "GOOGLE_CLIENT_ID",
    "https://app.acme.com/oauth/google");
social.AddProvider(TsgcHTMLSocialProvider.spGitHub, "GITHUB_CLIENT_ID",
    "https://app.acme.com/oauth/github");

string html = social.HTML;   // branded OAuth buttons

// Each item can build its own authorization URL:
string url = social.Providers.Items[0].GetAuthorizationURL();

Key properties & methods

The members you reach for most often.

Providers

AddProvider(aProvider, aClientID, aRedirectURI, aScope) appends a button; Providers is the TsgcHTMLSocialProviderItems collection you can also edit by hand.

Provider kinds

The TsgcHTMLSocialProvider enum covers spGoogle, spFacebook, spApple, spGitHub, spMicrosoft, spTwitter, spLinkedIn and spCustom.

Per-provider item

Each item exposes Provider, ClientID, RedirectURI, Scope, AuthURL, State, ButtonText, IconURL and CustomColor; GetAuthorizationURL returns the full URL.

Header & divider

Title and Subtitle head the panel; ShowDivider and DividerText draw the "or continue with" rule.

Layout & style

Layout chooses slVertical or slHorizontal; MaxWidth, ShowIcons, ButtonPadding and ButtonBorderRadius tune the buttons.

Output

HTML returns the button panel; an injected stylesheet adds the hover effect. Serve it, or assign it to a page template's BodyContent.

Keep exploring

All sgcHTML ComponentsBrowse the full feature matrix of 60+ components.
Download Free TrialThe 30-day trial ships the 60.HTML demo projects.
PricingSingle, Team and Site licenses with full source code.

Ready to Get Started?

Download the free trial and add social login to your Delphi, C++ Builder or .NET web app.