constructor Create(const AuthRequest: TScRestRequest; const UserName, Password: string); overload;
constructor Create(const Name, Endpoint, UserName, Password: string); overload;
Description
Creates an instance of the authenticator and initializes its properties.
The first constructor uses an existing TScRestRequest component to request a Bearer token.
The second constructor creates a TScRestRequest component and manages its lifetime.
Parameters:
• | AuthRequest – The TScRestRequest component used to obtain the Bearer token. |
• | UserName – The username for authenticating with the REST service. |
• | Password – The corresponding password. |
• | Name – The name assigned to the internally created TScRestRequest component. |
• | Endpoint – The REST service endpoint used to obtain the Bearer token. |
Example
RestClient.Authenticator := TScRestBearerAuthenticator.Create('Login', 'login', 'Alice', '1111');