Using Google accounts to sign-in/log-in to a Delphi app with TMS Cloud Pack

Hello.

I have searched through all TMS Cloud Pack demos and documentation and I could not find a way to allow my users to use their Google Account to authenticate and sign-in/log-in to my Delphi apps.

Do you have such functionality? If so, is there any sample code to show me how it is done?

As a reference, the “eSeGeCe” components include a specific class and very clear documentation on how to accomplish exactly what I want:

Google Sign-In Login for Delphi

Thank you !!

PS: I don’t have the “eSeGeCe" components

Hi,

All Google service-based components in TMS FNC Cloud Pack (e.g., TTMSFNCCloudGoogleDrive, TTMSFNCCloudGoogleGMail, etc.) inherit from the TTMSFNCCustomCloudGoogle class. This base class includes a GetUserInfo method that populates the Profile property with user data, allowing you to implement sign-in functionality in your Delphi application.

If your application doesn't require any specific Google service functionality, you can instantiate a TTMSFNCCustomCloudGoogle object in your code and use it to fetch the authenticated user's profile information.

uses
  FMX.TMSFNCCloudGoogle,

  public
    TMSFNCCloudGoogle: TTMSFNCCustomCloudGoogle;
  end;

//...

procedure TForm1.FormCreate(Sender: TObject);
begin
  TMSFNCCloudGoogle := TTMSFNCCustomCloudGoogle.Create(Self);
  TMSFNCCloudGoogle.OnConnected := TMSFNCCloudGoogleConnected;
  TMSFNCCloudGoogle.OnGetUserInfo := TMSFNCCloudGoogleGetUserInfo;

  TMSFNCCloudGoogle.Authentication.ClientID := 'clientid';
  TMSFNCCloudGoogle.Authentication.Secret := 'secret';
  TMSFNCCloudGoogle.Authentication.CallBackURL := 'http://localhost:8000';
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
  TMSFNCCloudGoogle.Free;
end;

procedure TForm1.TMSFNCCloudGoogleConnected(Sender: TObject);
begin
  TMSFNCCloudGoogle.GetUserInfo;
end;

procedure TForm1.TMSFNCCloudGoogleGetUserInfo(Sender: TObject;
  const ARequestResult: TTMSFNCCloudBaseRequestResult);
begin
  ShowMessage(TMSFNCCloudGoogle.Profile.FullName);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  TMSFNCCloudGoogle.Connect;
end;

Bart:

That is awesome !! :star_struck: :+1:t3:

I knew that the TMS Cloud Pack could be used for only authenticating a user, but I needed a true expert to show me how.

I will try it in my app and I will let you know the results.

Thank you !!

Miguel

Happy to help!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.