Skip to main content
Table of Contents

Getting started with TMS FNC Cloud Google People

Prerequisites

  • TMS FNC Core installed and the runtime package added to the project.
  • TMS FNC Cloud Pack installed.
  • A Google account and an OAuth 2.0 client (client ID and secret) created in the Google Cloud console with the People API enabled.

Add the component

  1. Drop TTMSFNCCloudGooglePeople onto a form or create it in code.
  2. Set the OAuth credentials (Authentication.ClientID, Authentication.Secret, Authentication.CallBackURL).
  3. Persist tokens and call Connect; once OnConnected fires, call GetContacts or GetGroups.

The minimal connect sequence — credentials, token persistence, and an OnConnected handler that saves the tokens and signals when requests are safe:

Authenticate and connect to Google PeoplePascalC++
procedure TForm1.SetupPeople;
begin
  FPeople := TTMSFNCCloudGooglePeople.Create(Self);

  // OAuth 2.0 client credentials from the Google Cloud console (People API enabled).
  FPeople.Authentication.ClientID := '<your-client-id>.apps.googleusercontent.com';
  FPeople.Authentication.Secret := '<your-client-secret>';
  FPeople.Authentication.CallBackURL := 'http://127.0.0.1:8000';

  // Persist tokens so the consent screen only appears on first run.
  FPeople.PersistTokens.Location := plIniFile;
  FPeople.PersistTokens.Key := TTMSFNCUtils.AddBackslash(TTMSFNCUtils.GetDocumentsPath)
    + FPeople.ClassName + '.ini';
  FPeople.LoadTokens;

  FPeople.OnConnected := PeopleConnected;
  FPeople.Connect; // opens the browser for consent on first run, then fires OnConnected
end;

procedure TForm1.PeopleConnected(Sender: TObject);
begin
  // Save the freshly obtained tokens, then it is safe to call GetContacts/GetGroups.
  FPeople.SaveTokens;
end;
void __fastcall TForm1::SetupPeople()
{
  FPeople = new TTMSFNCCloudGooglePeople(this);

  // OAuth 2.0 client credentials from the Google Cloud console (People API enabled).
  FPeople->Authentication->ClientID = "<your-client-id>.apps.googleusercontent.com";
  FPeople->Authentication->Secret = "<your-client-secret>";
  FPeople->Authentication->CallBackURL = "http://127.0.0.1:8000";

  // Persist tokens so the consent screen only appears on first run.
  FPeople->PersistTokens->Location = plIniFile;
  FPeople->PersistTokens->Key = TTMSFNCUtils::AddBackslash(TTMSFNCUtils::GetDocumentsPath())
    + FPeople->ClassName() + ".ini";
  FPeople->LoadTokens();

  FPeople->OnConnected = PeopleConnected;
  FPeople->Connect(); // opens the browser for consent on first run, then fires OnConnected
}

void __fastcall TForm1::PeopleConnected(TObject *Sender)
{
  // Save the freshly obtained tokens, then it is safe to call GetContacts/GetGroups.
  FPeople->SaveTokens();
}

Next steps

  • Guides — authentication, managing contacts, and managing groups.
  • API reference — full class reference.