OAuth2 プロバイダー | リクエスト

認証が成功したら、パブリック ID トークンを Cookie として使用して OAuth2 保護サーバーにリクエストを送信できます。

 

OAuth2 プロバイダーサーバーコンポーネントには、HTTP リクエストを送信するためのいくつかのメソッドがあります:GET、POST、DELETE...

 

Indy サーバーコンポーネントを使用している場合は、トークンをパラメーターとして渡すか、RequestInfo クラスを渡すことができます。

 


procedure OnCommandGet(AContext: TIdContext; ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo);
begin
  if ARequestInfo.Document = '/private' then
  begin
    // return OAuth2 profile data
    AResponseInfo.ContentText := OAuth2Provider.Get(ARequestInfo, 'https://graph.microsoft.com/v1.0/me');
    AResponseInfo.ContentType := 'application/json';
    AResponseInfo.ResponseNo := 200;
  end
  else
    AResponseInfo.ResponseNo := 404;
end;