Table of Contents

Getting started with TMS FNC Cloud Google Drive

Prerequisites

  • TMS FNC Core installed and the runtime package added to the project.
  • TMS FNC Cloud Pack installed.
  • A Google Cloud project with the Drive API enabled and an OAuth client ID, secret, and authorized redirect URI.

Add the component

  1. Drop TTMSFNCCloudGoogleDrive onto a form (or create it in code).
  2. Set the Google API credentials on Authentication (client ID, secret, redirect URI).
  3. Call Connect to authenticate, then call Drive operations from OnConnected.

Minimal example

Set the credentials, connect, and request the account info once connected:

procedure TForm1.FormCreate(Sender: TObject);
begin
  // OAuth client from a Google Cloud project with the Drive API enabled.
  TMSFNCCloudGoogleDrive1.Authentication.ClientID := 'your-google-client-id';
  TMSFNCCloudGoogleDrive1.Authentication.Secret := 'your-google-client-secret';
  // Must match an authorized redirect URI on the OAuth client.
  TMSFNCCloudGoogleDrive1.Authentication.CallBackURL := 'http://127.0.0.1:8000';

  TMSFNCCloudGoogleDrive1.OnConnected := DriveConnected;
  TMSFNCCloudGoogleDrive1.Connect;   // opens the Google consent screen
end;

procedure TForm1.DriveConnected(Sender: TObject);
begin
  // Tokens are now available; safe to call Drive operations.
  TMSFNCCloudGoogleDrive1.GetAccountInfo;
end;

Next steps