Show/Hide Toolbars

TMS XData Documentation

Navigation: TXDataClient

Authentication Settings

Scroll Prev Top Next More

For the HTTP communication, TXDataClient uses under the hood the Sparkle THttpClient. Such object is accessible through the TXDataClient.HttpClient property. You can use all properties and events of THttpClient class there, and the most common is the OnSendingRequest event, which you can use to set custom headers for the request. One common usage is to set the Authorization header with credentials, for example, a JSON Web Token retrieved from the server:

 

XDataClient.HttpClient.OnSendingRequest := 
   procedure(Req: THttpRequest)
   begin
     Req.Headers.SetValue('Authorization''Bearer ' + vToken);
   end;

 

 

Legacy Basic authentication

 

TXDataClient class provides you with the following properties for accessing servers protected with basic authentication.

 

property UserName: string;
property Password: string;

 

Defines the UserName and Password to be used to connect to the server. These properties are empty by default, meaning the client won't send any basic authentication info. This is equivalent to set the Authorization header with property Basic authentication value