How to move from VCL to FNC


My application has implementatios of TAdvGMail and TAdvGCalendar with OAuth. But for doing the same for Microsoft services, TMS team said me I needed to move to FNC style, so I buy that package but it has no examples about how to do all what I did with TAdvGMail and TAdvGCalender, specialy how to do the authorizations (how to get the token).

Any help will be appreciated.


Please note that the equivalent components in TMS FNC Cloud Pack are: TTMSFNCCloudGoogleGmail and TTMSFNCCloudGoogleCalendar.

Usage samples can be found in the Overview demo included with the TMS FNC Cloud Pack.

This is an authorization example:

  TMSFNCCloudGoogleGmail1.Authentication.ClientID := 'abc123';
  TMSFNCCloudGoogleGmail1.Authentication.Secret := 'xyz456';
  TMSFNCCloudGoogleGmail1.Authentication.CallBackURL := 'http://localhost:8888';

If authorization was successful the OnConnected event is triggered, otherwise the OnAccessDenied event.

I understand but, how do I get and save the token for later use?

You can use SaveTokens to save existing tokens.

This is mentioned in the online help:

Example to load persisted tokens from an INI file:

  TMSFNCCloudGoogleDrive1.PersistTokens.Location := plIniFile;
  TMSFNCCloudGoogleDrive1.PersistTokens.Key := 'filename.ini';

Yes, I alredy see that, but I have to save the strings in my own way, like when I use TokensAsString in the VCL style. I have to save on encripted/protected databases.

You can use the Authentication.AccessToken and Authentication.AccessTokenRefresh properties to get/set tokens.

Please, let me ask. CallbackURL must be necesary at 8888 ?

The port for the callback url can change, as long as that port isn't in use and you change it to the same url in the settings of the service itself. (In this case in your Google Authentication settings.)

I am really sorry for asking againg on this thread, but I was trying to follow your documentations and your source code, and I can't figure out how to do with FNC platform this very simple authentication process I used to do with the VCL platform:

procedure TMailConf.BtnGoogleClick(Sender: TObject);
GMail.App.Key := GAppkey_string;
GMail.App.Secret := GAppSecret_string;
GMail.TokensAsString := FSavedToken;
if not GMail.TestTokens then
if not GMail.TestTokens then

procedure TMailConf.GMailReceivedAccessToken(Sender: TObject);
FSavedToken := GMail.TokensAsString;

Please can you give a little example?

Thank you!


Below is a simple example of the authentication process in TMS FNC Cloud Pack.

If the PersistTokens.Key value is assigned, the access token will automatically be loaded/saved from/to an INI file.


procedure TForm1.Button1Click(Sender: TObject);
  GMail.Authentication.ClientID := GClientID;
  GMail.Authentication.Secret := GSecret;
  GMail.Authentication.CallBackURL := '';
  GMail.PersistTokens.Key := 'GMail';

procedure TForm1.GMailConnected(Sender: TObject);

This is explained in the online help: