OAuthCallback
TsgcHTMLComponent_OAuthCallback — Delphi, C++ Builder 및 .NET에서 로그인한 사용자와 자동 리디렉션을 표시하며 성공, 오류 또는 로딩 상태의 OAuth 랜딩 페이지를 렌더링합니다.
TsgcHTMLComponent_OAuthCallback — Delphi, C++ Builder 및 .NET에서 로그인한 사용자와 자동 리디렉션을 표시하며 성공, 오류 또는 로딩 상태의 OAuth 랜딩 페이지를 렌더링합니다.
OAuth 리디렉션 URI에서 제공하는 페이지입니다. Status와 사용자 세부 정보를 설정한 다음, HTML을 읽습니다 — 또는 한 줄짜리 정적 BuildSuccess, BuildError 및 BuildLoading 헬퍼를 사용하십시오.
정적 Build* 헬퍼는 완성된 페이지를 직접 렌더링합니다. 아바타, 리디렉션 방법 또는 사용자 지정 아이콘을 설정해야 할 때는 전체 컴포넌트를 사용하십시오.
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;
가장 자주 사용하게 되는 멤버.
BuildSuccess(aProviderName, aUserName, aRedirectURL, aUserEmail), BuildError(aProviderName, aErrorMessage) 및 BuildLoading(aProviderName)는 한 번의 호출로 완성된 페이지를 렌더링합니다.
Status는 csSuccess, csError 또는 csLoading을 선택합니다 — 체크, 십자 또는 스피너와 일치하는 텍스트를 표시합니다.
ProviderName, UserName, UserEmail 및 UserAvatar가 성공 카드를 채웁니다. ShowUserInfo와 AvatarSize가 그 표시를 제어합니다.
RedirectMethod(rmAutoRedirect, rmButtonOnly, rmNone) 및 RedirectDelay가 있는 RedirectURL이 로그인 후 내비게이션을 구동합니다.
SuccessIconColorEnum, ErrorIconColorEnum, SuccessIconText, ErrorIconText(그리고 원시 *IconHTML/*IconColor)와 MaxWidth가 카드를 스타일링합니다.
HTML은 콜백 카드를 반환합니다. ErrorMessage는 오류 상태에서 위험 알림을 채웁니다. OAuth 리디렉션 URI에서 제공하십시오.