OAuthCallback

TsgcHTMLComponent_OAuthCallback — render een OAuth landingspagina in success-, error- of loading-status, met de ingelogde gebruiker en een automatische redirect, in Delphi, C++ Builder en .NET.

TsgcHTMLComponent_OAuthCallback

De pagina die je serveert vanaf je OAuth redirect-URI. Stel de Status en gebruikersgegevens in en lees daarna HTML — of gebruik de statische helpers BuildSuccess, BuildError en BuildLoading voor een one-liner.

Componentklasse

TsgcHTMLComponent_OAuthCallback

Rendert

Bootstrap 5-callbackpagina

Familie

Authenticatie

Talen

Delphi, C++ Builder, .NET

Eén regel per uitkomst

De statische Build*-helpers renderen rechtstreeks een kant-en-klare pagina. Gebruik het volledige component wanneer je de avatar, redirect-methode of aangepaste iconen wilt instellen.

uses
  sgcHTML_Enums, sgcHTML_Component_OAuthCallback;

// Success page (with auto-redirect to /dashboard):
WebModule.Response := TsgcHTMLComponent_OAuthCallback.BuildSuccess(
  'Google', 'Jane Doe', '/dashboard', 'jane@acme.com');

// Error page:
WebModule.Response := TsgcHTMLComponent_OAuthCallback.BuildError(
  'Google', 'access_denied');

// Loading / interstitial page:
WebModule.Response := TsgcHTMLComponent_OAuthCallback.BuildLoading('Google');

// Full control:
var
  oCB: TsgcHTMLComponent_OAuthCallback;
begin
  oCB := TsgcHTMLComponent_OAuthCallback.Create(nil);
  try
    oCB.Status := csSuccess;
    oCB.ProviderName := 'Google';
    oCB.UserName := 'Jane Doe';
    oCB.UserAvatar := 'https://acme.com/u/jane.png';
    oCB.RedirectURL := '/dashboard';
    oCB.RedirectMethod := rmAutoRedirect;
    oCB.RedirectDelay := 3;
    WebModule.Response := oCB.HTML;
  finally
    oCB.Free;
  end;
end;
// includes: sgcHTML_Enums.hpp, sgcHTML_Component_OAuthCallback.hpp

// Success page (with auto-redirect to /dashboard):
String ok = TsgcHTMLComponent_OAuthCallback::BuildSuccess(
  "Google", "Jane Doe", "/dashboard", "jane@acme.com");

// Error page:
String err = TsgcHTMLComponent_OAuthCallback::BuildError(
  "Google", "access_denied");

// Loading / interstitial page:
String wait = TsgcHTMLComponent_OAuthCallback::BuildLoading("Google");

// Full control:
TsgcHTMLComponent_OAuthCallback *oCB = new TsgcHTMLComponent_OAuthCallback(NULL);
try
{
  oCB->Status = csSuccess;
  oCB->ProviderName = "Google";
  oCB->UserName = "Jane Doe";
  oCB->UserAvatar = "https://acme.com/u/jane.png";
  oCB->RedirectURL = "/dashboard";
  oCB->RedirectMethod = rmAutoRedirect;
  oCB->RedirectDelay = 3;
  String html = oCB->HTML;
}
__finally
{
  delete oCB;
}
using esegece.sgcWebSockets;

// Success page (with auto-redirect to /dashboard):
string ok = TsgcHTMLComponent_OAuthCallback.BuildSuccess(
    "Google", "Jane Doe", "/dashboard", "jane@acme.com");

// Error page:
string err = TsgcHTMLComponent_OAuthCallback.BuildError(
    "Google", "access_denied");

// Loading / interstitial page:
string wait = TsgcHTMLComponent_OAuthCallback.BuildLoading("Google");

// Full control:
var cb = new TsgcHTMLComponent_OAuthCallback();
cb.Status = TsgcHTMLOAuthCallbackStatus.csSuccess;
cb.ProviderName = "Google";
cb.UserName = "Jane Doe";
cb.UserAvatar = "https://acme.com/u/jane.png";
cb.RedirectURL = "/dashboard";
cb.RedirectMethod = TsgcHTMLOAuthRedirectMethod.rmAutoRedirect;
cb.RedirectDelay = 3;
string html = cb.HTML;

Belangrijkste eigenschappen en methoden

De members die je het vaakst gebruikt.

Statische builders

BuildSuccess(aProviderName, aUserName, aRedirectURL, aUserEmail), BuildError(aProviderName, aErrorMessage) en BuildLoading(aProviderName) renderen een kant-en-klare pagina in één aanroep.

Status

Status kiest csSuccess, csError of csLoading — een vinkje, een kruisje of een spinner, met bijbehorende tekst.

Gebruikersinfo

ProviderName, UserName, UserEmail en UserAvatar vullen de success-kaart; ShowUserInfo en AvatarSize bepalen de weergave.

Redirect

RedirectURL met RedirectMethod (rmAutoRedirect, rmButtonOnly, rmNone) en RedirectDelay sturen de navigatie na het inloggen.

Iconen en lay-out

SuccessIconColorEnum, ErrorIconColorEnum, SuccessIconText, ErrorIconText (en de ruwe *IconHTML/*IconColor) plus MaxWidth stylen de kaart.

Uitvoer

HTML geeft de callback-kaart terug; ErrorMessage vult de danger-melding in de error-status. Serveer het vanaf je OAuth redirect-URI.

Blijf ontdekken

Alle sgcHTML-componentenVerken de volledige functiematrix met meer dan 60 componenten.
Download gratis proefversieDe proefversie van 30 dagen bevat de 60.HTML-demoprojecten.
PrijzenSingle-, Team- en Site-licenties met volledige broncode.

Klaar om te beginnen?

Download de gratis proefversie en voeg OAuth callbackpagina's toe aan je Delphi-, C++ Builder- of .NET-webapp.