TAdvGCalendar & DataSnap Server

Hello Folks!

I would like to integrate a Google Calendar synchronisation with an existing DataSnap server. It would be nice is the task could run in a separate thread on the application server. As far as I understand TCloudGoogleWin.DoAuth always will show A TWebBrowser instance to let the user accept the Google Calendar API integration of my application. But in a Windows Service this will not be an option. Are there ways around this in order to store the necessary credentials encrypted on the DataSnap server side?

I know it will work if I put this functionality into the client. but I thought I could use the TDataSetProvider.AfterUpdateRecord to push changes on my appointment table into the Google Calendar, which would be transparent to the user.

Am I dreaming here?

Thanks for a short answer in advance.

Salut,
  Mathias

For authentication & authorization, a browser is needed & necessary as it is the way to perform this authentication & authorization on the Google servers. After authentication & authorization, an access token is obtained that allows use of the service. A possible solution is to create a client that gets this access token via authentication & authorization and store this somewhere with CloudComponent.TokensAsString and then let your service read this access token back via setting CloudComponent.TokensAsString.

Hello Bruno,
Thanks for your reply. I will look at this option of using an access token obtained by the client and then sent to the DataSnap server. It needs to be encrypted and stored in the database or INI file of the DataSnap server. Does it ever expire?
Doing the task on the application server side means I can handle the synchronisation between my appointment table and the Google Calendar of the sales consultant without further intervention by the user.
Salut,
  Mathias

  1. TokensAsString is already an encrypted string
    2) Google access tokens expire. You can call RefreshTokens though to get a new access token after expiry. RefreshTokens doesn't require user interaction.

Hello Bruno,

the Google Calendar integration is working in my
DataSnap server after just one day of work. That is pretty impressive. A
custom-designed worker thread is doing the task in the background. So far it's app server to Google Calendar only, but I shall look at the other direction soon (need to enforce special format in the memo field Description).

My customer is using different colours for certain appointments and would like to continue doing so.
May I add to the wish-list the support for colorId, backgroundColor & foregroundColor on the TGCalendarItem (called resource in the Google Calendar API docu)?

Thanks for considering this.

Salut,
  Mathias

We are working for the next update of TMS Cloud Pack to have support for setting Google calendar items colors.