OAuthCallback

TsgcHTMLComponent_OAuthCallback — Delphi、C++ Builder、.NET で、サインインしたユーザーと自動リダイレクトを表示し、OAuth のランディングページを成功、エラー、または読み込み中の状態でレンダリングします。

TsgcHTMLComponent_OAuthCallback

OAuth のリダイレクト URI から配信するページです。Status とユーザーの詳細を設定してから、HTML を読み取ります — または、静的な BuildSuccessBuildErrorBuildLoading ヘルパーを使って一行で記述します。

コンポーネントクラス

TsgcHTMLComponent_OAuthCallback

レンダリング内容

Bootstrap 5 のコールバックページ

ファミリー

認証

言語

Delphi, C++ Builder, .NET

結果ごとに一行

静的な 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;

主なプロパティとメソッド

最もよく使うメンバーです。

Static builders

BuildSuccess(aProviderName, aUserName, aRedirectURL, aUserEmail)BuildError(aProviderName, aErrorMessage)BuildLoading(aProviderName) は、完成したページを 1 回の呼び出しでレンダリングします。

Status

StatuscsSuccesscsErrorcsLoading を選択します — チェック、バツ、またはスピナーを、対応する文言とともに表示します。

User info

ProviderNameUserNameUserEmailUserAvatar は成功カードを構成します。ShowUserInfoAvatarSize はその表示を制御します。

Redirect

RedirectMethodrmAutoRedirectrmButtonOnlyrmNone)と RedirectDelay を伴う RedirectURL が、ログイン後のナビゲーションを駆動します。

Icons & layout

SuccessIconColorEnumErrorIconColorEnumSuccessIconTextErrorIconText(および生の *IconHTML/*IconColor)に加え、MaxWidth がカードのスタイルを設定します。

Output

HTML はコールバックカードを返します。ErrorMessage は、エラー状態で danger アラートを構成します。OAuth のリダイレクト URI から配信してください。

さらに詳しく

すべての sgcHTML コンポーネント60 以上のコンポーネントの全機能マトリックスを閲覧できます。
無料体験版のダウンロード30 日間の体験版には 60.HTML デモプロジェクトが付属します。
価格完全なソースコード付きの Single、Team、Site ライセンス。

始める準備はできましたか?

無料体験版をダウンロードして、Delphi、C++ Builder、.NET の Web アプリに OAuth コールバックページを追加しましょう。