OAuthCallback
TsgcHTMLComponent_OAuthCallback — renderiza una página de aterrizaje OAuth en estado de éxito, error o carga, mostrando el usuario que ha iniciado sesión y una redirección automática, en Delphi, C++ Builder y .NET.
TsgcHTMLComponent_OAuthCallback — renderiza una página de aterrizaje OAuth en estado de éxito, error o carga, mostrando el usuario que ha iniciado sesión y una redirección automática, en Delphi, C++ Builder y .NET.
La página que sirves desde tu URI de redirección OAuth. Define el Status y los datos del usuario y luego lee HTML — o usa las ayudas estáticas BuildSuccess, BuildError y BuildLoading para hacerlo en una línea.
TsgcHTMLComponent_OAuthCallback
Página de callback de Bootstrap 5
Delphi, C++ Builder, .NET
Las ayudas estáticas Build* renderizan una página terminada directamente. Usa el componente completo cuando necesites definir el avatar, el método de redirección o iconos personalizados.
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;
Los miembros que más vas a usar.
BuildSuccess(aProviderName, aUserName, aRedirectURL, aUserEmail), BuildError(aProviderName, aErrorMessage) y BuildLoading(aProviderName) renderizan una página terminada en una sola llamada.
Status selecciona csSuccess, csError o csLoading — una marca de verificación, una cruz o un indicador de carga, con el texto correspondiente.
ProviderName, UserName, UserEmail y UserAvatar rellenan la tarjeta de éxito; ShowUserInfo y AvatarSize controlan su presentación.
RedirectURL con RedirectMethod (rmAutoRedirect, rmButtonOnly, rmNone) y RedirectDelay impulsan la navegación posterior al inicio de sesión.
SuccessIconColorEnum, ErrorIconColorEnum, SuccessIconText, ErrorIconText (y los *IconHTML/*IconColor en bruto) junto con MaxWidth dan estilo a la tarjeta.
HTML devuelve la tarjeta de callback; ErrorMessage rellena la alerta de peligro en el estado de error. Sírvela desde tu URI de redirección OAuth.