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 — render een OAuth landingspagina in success-, error- of loading-status, met de ingelogde gebruiker en een automatische redirect, in Delphi, C++ Builder en .NET.
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.
TsgcHTMLComponent_OAuthCallback
Bootstrap 5-callbackpagina
Delphi, C++ Builder, .NET
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;
De members die je het vaakst gebruikt.
BuildSuccess(aProviderName, aUserName, aRedirectURL, aUserEmail), BuildError(aProviderName, aErrorMessage) en BuildLoading(aProviderName) renderen een kant-en-klare pagina in één aanroep.
Status kiest csSuccess, csError of csLoading — een vinkje, een kruisje of een spinner, met bijbehorende tekst.
ProviderName, UserName, UserEmail en UserAvatar vullen de success-kaart; ShowUserInfo en AvatarSize bepalen de weergave.
RedirectURL met RedirectMethod (rmAutoRedirect, rmButtonOnly, rmNone) en RedirectDelay sturen de navigatie na het inloggen.
SuccessIconColorEnum, ErrorIconColorEnum, SuccessIconText, ErrorIconText (en de ruwe *IconHTML/*IconColor) plus MaxWidth stylen de kaart.
HTML geeft de callback-kaart terug; ErrorMessage vult de danger-melding in de error-status. Serveer het vanaf je OAuth redirect-URI.