OAuth2 Sağlayıcısı | İstekler

Kimlik Doğrulama başarılı olduktan sonra, çerez olarak saklanan Public ID Token'i kullanarak OAuth2 Korumalı Sunucusuna istek gönderebilirsiniz.

 

OAuth2 Provider Server Bileşeni, HTTP İstekleri göndermek için çeşitli yöntemlere sahiptir: GET, POST, DELETE...

 

Token'ı bir parametre olarak geçirebilir veya Indy Server bileşenlerini kullanıyorsanız RequestInfo sınıfını geçirebilirsiniz.

 


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;