Skip to main content

TdxOAuth2AuthorizationAgentUserInfo Class

The base class for user information providers with support for the OAuth 2.0 authentication protocol.

Declaration

TdxOAuth2AuthorizationAgentUserInfo = class abstract(TdxAuthorizationAgentUserInfo, IdxOAuth2AuthorizationAgentScopeRequestor)

Remarks

A user information provider is designed to obtain general account information (such as user name or e-mail) from an online service.

Main API Members

The list below outlines key members of the TdxOAuth2AuthorizationAgentUserInfo class. These members allow you to obtain user information from an online service account.

Online Service Interaction APIs

AuthorizationAgent
Provides access to the parent authorization agent component.
GetUserInfo
Creates a new user information provider for the target authorization agent component.
UpdateInfo
Connects to an online service account through the parent authorization agent and loads user information.

User Information APIs

DisplayName
Returns the display name of the connected account’s owner.
Mail
Returns the e-mail of the connected account’s owner.

Code Example

The following code example creates a user information provider and uses a configured TdxMicrosoftGraphAPIOAuth2AuthorizationAgent component to display user information from an online account in the form caption:

var
  AInfo: TdxAuthorizationAgentUserInfo;
begin
  AInfo := TdxAuthorizationAgentUserInfo.GetUserInfo(dxMicrosoftGraphAPIOAuth2AuthorizationAgent1);
  if AInfo = nil then Exit;
  try
    AInfo.UpdateInfo;  // Obtains user information through the authorization agent component
    Caption := Caption + Format(' User Name: %s; e-mail: %s', [AInfo.DisplayName, AInfo.Mail]);
  finally
    AInfo.Free;  // Releases the user information provider to avoid memory leaks
  end;
end;

Terminal TdxOAuth2AuthorizationAgentUserInfo Class Descendants

Do not use the TdxOAuth2AuthorizationAgentUserInfo class directly. Use the following descendants instead:

TdxGoogleAPIOAuth2AuthorizationAgentUserInfo
A data provider designed to load user information from a connected Google online account.
TdxMicrosoftGraphAPIOAuth2AuthorizationAgentUserInfo
A data provider designed to load user information from a connected Microsoft online account.

Other Online Service Data Providers

User information providers allow you to retrieve only basic user information from a compatible online service account. The sections below list dedicated online service data provider classes that allow you to synchronize data between an online account and your desktop VCL application.

Cloud Storage Provider Classes

You can use the following data providers to synchronize data between the TdxCloudStorage component and a cloud storage account.

TdxCloudStorageGoogleDriveProvider
An online file provider that can work with the Google Drive file storage service.
TdxCloudStorageMicrosoftOneDriveProvider
An online file data provider that can work with Microsoft OneDrive®.

Online Calendar Provider Classes

You can use the following data providers to synchronize events between the TcxScheduler control and an online calendar.

TcxSchedulerWebServiceStorageGoogleProvider
An online event data provider that can work with Google accounts.
TcxSchedulerWebServiceStorageOfficeProvider
An online event data provider that can work with Microsoft accounts.

Inheritance

See Also