PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Properties specific to the description of gglConnection variables
  • Prerequisites for the OAuth 2.0 authentication
  • Persistence of connection
  • Functions that use a gglConnection variable
  • Syntax compatible until April 2015 (can be used with the versions earlier than version 20)
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
gglConnection (Type of variable)
In French: gglConnexion (Type de variable)
The gglConnection type is used to describe a connection to the Google services and to manage the authentication beside different services. The characteristics of this connection can be defined and modified by several WLanguage properties.
Warning
From version 20 (51), the management of Google documents evolves.
Indeed, the management of Google documents in WLanguage was using the "Google Documents List" service. The "Google Documents List" service will no longer be accessible from April 2015.

From now on, only the "Drive" API can be used. Using this API in your applications requires:
  • the declaration of the application in the Google console,
  • the activation of "Drive" API in the Google console.
See the help about gglConnect ("Prerequisite for the OAuth 2.0 authentication" paragraph) for more details.
The WLanguage functions and types used to manage the Google documents evolve in order to manage the "Drive" API from version 200051.
Note: If you are using an earlier version of WINDEV, WEBDEV or WINDEV Mobile, the functions for managing the Google documents can no longer be used from April 2015.
Note: See Declaring a variable for more details.
Example
// CAUTION: FROM VERSION 20, THE GGLCONNECTION TYPE CHANGES
// Connection
Cnt is gglConnection
Cnt..Email = "email_final_user@gmail.com"
Cnt..ClientID = "387756281032-qffa6dajjd5348iqhi558dkd98xxxxxx.apps.googleusercontent.com"
Cnt..ClientSecret = "S13DCA6KkYh1EgPv9-jLxxxh"
IF GglConnect(Cnt) = False THEN
Error(ErrorInfo())
END
Remarks

Properties specific to the description of gglConnection variables

Versions 20 and later
The following properties can be used to handle a Google connection:
NameType used Effect
ClientIDCharacter stringClient identifier given when declaring the application in the Google console.
ClientSecretCharacter stringSecret code of the client given when declaring the application in the Google console.
EmailCharacter stringEmail of final client. This property is optional. This property is used to pre-fill the login window of the client to his Google account.
Caution: This property cannot be used to retrieve the email account of the authenticated account.
Note: These properties can be used with one of the following syntaxes:
  • <Variable Name>..<Property Name>
  • <Variable Name>.<Property Name>
New in version 20
The following properties can be used to handle a Google connection:
NameType used Effect
ClientIDCharacter stringClient identifier given when declaring the application in the Google console.
ClientSecretCharacter stringSecret code of the client given when declaring the application in the Google console.
EmailCharacter stringEmail of final client. This property is optional. This property is used to pre-fill the login window of the client to his Google account.
Caution: This property cannot be used to retrieve the email account of the authenticated account.
Note: These properties can be used with one of the following syntaxes:
  • <Variable Name>..<Property Name>
  • <Variable Name>.<Property Name>
The following properties can be used to handle a Google connection:
NameType used Effect
ClientIDCharacter stringClient identifier given when declaring the application in the Google console.
ClientSecretCharacter stringSecret code of the client given when declaring the application in the Google console.
EmailCharacter stringEmail of final client. This property is optional. This property is used to pre-fill the login window of the client to his Google account.
Caution: This property cannot be used to retrieve the email account of the authenticated account.
Note: These properties can be used with one of the following syntaxes:
  • <Variable Name>..<Property Name>
  • <Variable Name>.<Property Name>
Versions 20 and later

Prerequisites for the OAuth 2.0 authentication

To connect with the OAuth 2.0 authentication, the application must be declared on your Google developer console: https://developers.google.com/console.
In the console:
  1. Click "Create a project". Give the name of your project. An identifier is automatically proposed for your project.
  2. Validate
  3. The project is created.
  4. In the menu on the left, click "API and authentication" then "API".
  5. Choose the services required by the application:
    • To access the calendars, choose "Calendar API" ("Google Apps APIs" category).
    • To access the contacts, choose "Contacts API" ("Google Apps APIs" category).
    • To access the Google documents, choose "Drive API" ("Google Apps APIs" category).
    • To access the Picasa albums and the documents, there is no need to select a specific API.
  6. In the menu on the left, click "Identifiers".
  7. Then, click the "Create a client identifier" button.
    • Select the type of application: "Application installed".
    • The authorization screen must be configured during the first creation of client identifier.
    • In the authorisation screen, in the "Product name" area, enter the name of your application for example.
    • Click "Save".
    • The screen for creating the client identifier is re-displayed.
      • WINDEVWindows Mobile For the WINDEV and WINDEV Mobile applications, select "Application installed" then "Other".
      • WEBDEV - Server code For the WEBDEV sites, select "Web application". In the "Authorized redirection URI" area, enter the address of the Web server where your site is installed followed by "/WD220AWP/WD220Awp.exe/GGLCONNECT_RETURN". The syntax has the following type:
        http[s]://<Server_Name_or_IP>[:<Port>]/WD220AWP/WD220Awp.exe/GGLCONNECT_RETURN

        For example:
        • In test mode, with a Web server configured on the default port (80):
          http://localhost/WD220AWP/WD220Awp.exe/GGLCONNECT_RETURN
        • In test mode, with a Web server configured on port 8080:
          http://localhost:8080/WD220AWP/WD220Awp.exe/GGLCONNECT_RETURN
        • In Internet deployment, with a Web server configured on the default port with "www.mydomain.com" as domain:
          http://www.mydomain.com/WD220AWP/WD220Awp.exe/GGLCONNECT_RETURN
        • In Internet deployment, with a Web server configured in https on the default port (443) with "www.mydomain.com" as domain:
          https://www.mydomain.com/WD220AWP/WD220Awp.exe/GGLCONNECT_RETURN
        • In Intranet deployment, with a Web server configured on port 81 with "IntranetServer" as computer name:
          http://IntranetServer:81/WD220AWP/WD220Awp.exe/GGLCONNECT_RETURN

          where <DomainName> corresponds to the name of the site domain.
    • Validate. The client identifiers are created:
      • Client identifier. This identifier must be stored. It will be used in the gglConnection variable.
      • Secret code of client. This identifier must be stored. It will be used in the gglConnection variable.
      • WINDEVWINDEV Mobile Redirection URI. Check whether "http://localhost" is specified.
New in version 20

Prerequisites for the OAuth 2.0 authentication

To connect with the OAuth 2.0 authentication, the application must be declared on your Google developer console: https://developers.google.com/console.
In the console:
  1. Click "Create a project". Give the name of your project. An identifier is automatically proposed for your project.
  2. Validate
  3. The project is created.
  4. In the menu on the left, click "API and authentication" then "API".
  5. Choose the services required by the application:
    • To access the calendars, choose "Calendar API" ("Google Apps APIs" category).
    • To access the contacts, choose "Contacts API" ("Google Apps APIs" category).
    • To access the Google documents, choose "Drive API" ("Google Apps APIs" category).
    • To access the Picasa albums and the documents, there is no need to select a specific API.
  6. In the menu on the left, click "Identifiers".
  7. Then, click the "Create a client identifier" button.
    • Select the type of application: "Application installed".
    • The authorization screen must be configured during the first creation of client identifier.
    • In the authorisation screen, in the "Product name" area, enter the name of your application for example.
    • Click "Save".
    • The screen for creating the client identifier is re-displayed.
      • WINDEVWindows Mobile For the WINDEV and WINDEV Mobile applications, select "Application installed" then "Other".
      • WEBDEV - Server code For the WEBDEV sites, select "Web application". In the "Authorized redirection URI" area, enter the address of the Web server where your site is installed followed by "/WD220AWP/WD220Awp.exe/GGLCONNECT_RETURN". The syntax has the following type:
        http[s]://<Server_Name_or_IP>[:<Port>]/WD220AWP/WD220Awp.exe/GGLCONNECT_RETURN

        For example:
        • In test mode, with a Web server configured on the default port (80):
          http://localhost/WD220AWP/WD220Awp.exe/GGLCONNECT_RETURN
        • In test mode, with a Web server configured on port 8080:
          http://localhost:8080/WD220AWP/WD220Awp.exe/GGLCONNECT_RETURN
        • In Internet deployment, with a Web server configured on the default port with "www.mydomain.com" as domain:
          http://www.mydomain.com/WD220AWP/WD220Awp.exe/GGLCONNECT_RETURN
        • In Internet deployment, with a Web server configured in https on the default port (443) with "www.mydomain.com" as domain:
          https://www.mydomain.com/WD220AWP/WD220Awp.exe/GGLCONNECT_RETURN
        • In Intranet deployment, with a Web server configured on port 81 with "IntranetServer" as computer name:
          http://IntranetServer:81/WD220AWP/WD220Awp.exe/GGLCONNECT_RETURN

          where <DomainName> corresponds to the name of the site domain.
    • Validate. The client identifiers are created:
      • Client identifier. This identifier must be stored. It will be used in the gglConnection variable.
      • Secret code of client. This identifier must be stored. It will be used in the gglConnection variable.
      • WINDEVWINDEV Mobile Redirection URI. Check whether "http://localhost" is specified.

Prerequisites for the OAuth 2.0 authentication

To connect with the OAuth 2.0 authentication, the application must be declared on your Google developer console: https://developers.google.com/console.
In the console:
  1. Click "Create a project". Give the name of your project. An identifier is automatically proposed for your project.
  2. Validate
  3. The project is created.
  4. In the menu on the left, click "API and authentication" then "API".
  5. Choose the services required by the application:
    • To access the calendars, choose "Calendar API" ("Google Apps APIs" category).
    • To access the contacts, choose "Contacts API" ("Google Apps APIs" category).
    • To access the Google documents, choose "Drive API" ("Google Apps APIs" category).
    • To access the Picasa albums and the documents, there is no need to select a specific API.
  6. In the menu on the left, click "Identifiers".
  7. Then, click the "Create a client identifier" button.
    • Select the type of application: "Application installed".
    • The authorization screen must be configured during the first creation of client identifier.
    • In the authorisation screen, in the "Product name" area, enter the name of your application for example.
    • Click "Save".
    • The screen for creating the client identifier is re-displayed.
      • WINDEVWindows Mobile For the WINDEV and WINDEV Mobile applications, select "Application installed" then "Other".
      • WEBDEV - Server code For the WEBDEV sites, select "Web application". In the "Authorized redirection URI" area, enter the address of the Web server where your site is installed followed by "/WD220AWP/WD220Awp.exe/GGLCONNECT_RETURN". The syntax has the following type:
        http[s]://<Server_Name_or_IP>[:<Port>]/WD220AWP/WD220Awp.exe/GGLCONNECT_RETURN

        For example:
        • In test mode, with a Web server configured on the default port (80):
          http://localhost/WD220AWP/WD220Awp.exe/GGLCONNECT_RETURN
        • In test mode, with a Web server configured on port 8080:
          http://localhost:8080/WD220AWP/WD220Awp.exe/GGLCONNECT_RETURN
        • In Internet deployment, with a Web server configured on the default port with "www.mydomain.com" as domain:
          http://www.mydomain.com/WD220AWP/WD220Awp.exe/GGLCONNECT_RETURN
        • In Internet deployment, with a Web server configured in https on the default port (443) with "www.mydomain.com" as domain:
          https://www.mydomain.com/WD220AWP/WD220Awp.exe/GGLCONNECT_RETURN
        • In Intranet deployment, with a Web server configured on port 81 with "IntranetServer" as computer name:
          http://IntranetServer:81/WD220AWP/WD220Awp.exe/GGLCONNECT_RETURN

          where <DomainName> corresponds to the name of the site domain.
    • Validate. The client identifiers are created:
      • Client identifier. This identifier must be stored. It will be used in the gglConnection variable.
      • Secret code of client. This identifier must be stored. It will be used in the gglConnection variable.
      • WINDEVWINDEV Mobile Redirection URI. Check whether "http://localhost" is specified.
Versions 20 and later

Persistence of connection

During the connection to the Google services, the authentication tokens are not saved. Therefore, you will have to re-log and to re-allow the access to the application whenever the application is run (which means whenever a "blank" gglConnection variable is used).
In order for the access authorization to be persistent, all you have to do is call the serialization functions of WLanguage.
Example for implementing the persistence by using an XML file:
let sAuthPersistenceFile = SysDir(srLocalAppData) + [fSep] + "gglauth.xml"

cnt is gglConnection
// If connection already established
IF fFileExist(sAuthPersistenceFile) THEN
// Restore the connection
let bufDeserialize = fLoadBuffer(sAuthPersistenceFile)
Deserialize(cnt, bufDeserialize, psdXML)
ELSE
// New connection
cnt.Email = "email@gmail.com"
cnt.ClientID = "387756281032-qffa6dajjd5348iqhi558xxxxxxxx.apps.googleusercontent.com"
cnt.ClientSecret = "Sxxxxx-jLMwwh"
END

IF GglConnect(cnt, gglCalendarService) THEN
// Save the connection in order to re-use it later
bufSerialize is Buffer
Serialize(cnt, bufSerialize, psdXML)
fSaveBuffer(sAuthPersistenceFile, bufSerialize)
END
Note: The authentication tokens of a gglConnection variable can be cleared via GglDisconnect.
New in version 20

Persistence of connection

During the connection to the Google services, the authentication tokens are not saved. Therefore, you will have to re-log and to re-allow the access to the application whenever the application is run (which means whenever a "blank" gglConnection variable is used).
In order for the access authorization to be persistent, all you have to do is call the serialization functions of WLanguage.
Example for implementing the persistence by using an XML file:
let sAuthPersistenceFile = SysDir(srLocalAppData) + [fSep] + "gglauth.xml"

cnt is gglConnection
// If connection already established
IF fFileExist(sAuthPersistenceFile) THEN
// Restore the connection
let bufDeserialize = fLoadBuffer(sAuthPersistenceFile)
Deserialize(cnt, bufDeserialize, psdXML)
ELSE
// New connection
cnt.Email = "email@gmail.com"
cnt.ClientID = "387756281032-qffa6dajjd5348iqhi558xxxxxxxx.apps.googleusercontent.com"
cnt.ClientSecret = "Sxxxxx-jLMwwh"
END

IF GglConnect(cnt, gglCalendarService) THEN
// Save the connection in order to re-use it later
bufSerialize is Buffer
Serialize(cnt, bufSerialize, psdXML)
fSaveBuffer(sAuthPersistenceFile, bufSerialize)
END
Note: The authentication tokens of a gglConnection variable can be cleared via GglDisconnect.

Persistence of connection

During the connection to the Google services, the authentication tokens are not saved. Therefore, you will have to re-log and to re-allow the access to the application whenever the application is run (which means whenever a "blank" gglConnection variable is used).
In order for the access authorization to be persistent, all you have to do is call the serialization functions of WLanguage.
Example for implementing the persistence by using an XML file:
let sAuthPersistenceFile = SysDir(srLocalAppData) + [fSep] + "gglauth.xml"

cnt is gglConnection
// If connection already established
IF fFileExist(sAuthPersistenceFile) THEN
// Restore the connection
let bufDeserialize = fLoadBuffer(sAuthPersistenceFile)
Deserialize(cnt, bufDeserialize, psdXML)
ELSE
// New connection
cnt.Email = "email@gmail.com"
cnt.ClientID = "387756281032-qffa6dajjd5348iqhi558xxxxxxxx.apps.googleusercontent.com"
cnt.ClientSecret = "Sxxxxx-jLMwwh"
END

IF GglConnect(cnt, gglCalendarService) THEN
// Save the connection in order to re-use it later
bufSerialize is Buffer
Serialize(cnt, bufSerialize, psdXML)
fSaveBuffer(sAuthPersistenceFile, bufSerialize)
END
Note: The authentication tokens of a gglConnection variable can be cleared via GglDisconnect.

Functions that use a gglConnection variable

All the functions for communicating with the Google services take a gglConnection variable in parameter.
Versions 14 and later
GglConnect
New in version 14
GglConnect
GglConnect
Used to perform an authentication beside a Google server.
Versions 14 and later
GglDelete
New in version 14
GglDelete
GglDelete
Deletes data from the Google server.
Versions 20 and later
GglDisconnect
New in version 20
GglDisconnect
GglDisconnect
Disconnects the user from the Google services used. During the next re-connection, the authorizations linked to the Google services will be asked again.
Versions 14 and later
GglFillAlbum
New in version 14
GglFillAlbum
GglFillAlbum
Fills a Google Picasa album with the data corresponding to the requested options.
Versions 14 and later
GglFillCalendar
New in version 14
GglFillCalendar
GglFillCalendar
Fills a calendar that was retrieved beforehand: the events corresponding to the calendar are retrieved (some criteria may be specified).
Versions 14 and later
GglFillCalendarByRequest
New in version 14
GglFillCalendarByRequest
GglFillCalendarByRequest
Fills a calendar that was retrieved beforehand: the events corresponding to the calendar are retrieved from a custom query.
Versions 14 and later
GglFillPhoto
New in version 14
GglFillPhoto
GglFillPhoto
Retrieves the details about the photos found in a Google Picasa album: initial image, comments, tags, thumbnails.
Versions 14 and later
GglGetAlbum
New in version 14
GglGetAlbum
GglGetAlbum
Retrieves a Google Picasa album.
Versions 14 and later
GglGetCalendar
New in version 14
GglGetCalendar
GglGetCalendar
Retrieves a Google calendar and its events according to its title or identifier.
Versions 17 and later
GglGetDocument
New in version 17
GglGetDocument
GglGetDocument
Downloads a document from the Google Docs service.
Versions 14 and later
GglListAlbum
New in version 14
GglListAlbum
GglListAlbum
Retrieves the list of "Google Picasa" albums available for the user.
Versions 14 and later
GglListCalendar
New in version 14
GglListCalendar
GglListCalendar
Retrieves the list of Google calendars associated with the specified Google account.
Versions 14 and later
GglListComment
New in version 14
GglListComment
GglListComment
Retrieves:
  • the list of comments saved for the Google client account.
  • the list of comments associated with a photo found in a Google Picasa album.
Versions 14 and later
GglListContact
New in version 14
GglListContact
GglListContact
Retrieves the list of contacts associated with the specified Google account.
Versions 14 and later
GglListContactByRequest
New in version 14
GglListContactByRequest
GglListContactByRequest
Retrieves a list of contacts from custom parameters.
Versions 14 and later
GglListContactGroup
New in version 14
GglListContactGroup
GglListContactGroup
Retrieves the list of groups of contacts associated with the specified Google account.
Versions 14 and later
GglListDocument
New in version 14
GglListDocument
GglListDocument
Retrieves the list of documents available on the Google server for the current user.
Versions 14 and later
GglListPhoto
New in version 14
GglListPhoto
GglListPhoto
Lists the photos found in the Google Picasa albums corresponding to specific criteria.
Versions 14 and later
GglListTag
New in version 14
GglListTag
GglListTag
Retrieves:
  • the list of tags associated with a Google client account.
  • the list of tags associated with a Google Picasa album.
  • the list of tags associated with a photo found in a Google Picasa album.
Versions 14 and later
GglRequest
New in version 14
GglRequest
GglRequest
Sends a communication request (HTTP request) to a Google service.
Versions 14 and later
GglUploadDocument
New in version 14
GglUploadDocument
GglUploadDocument
Sends a document to the Google server.
Versions 14 and later
GglWrite
New in version 14
GglWrite
GglWrite
Creates and/or updates data on the Google server (addition or modification of data).

Syntax compatible until April 2015 (can be used with the versions earlier than version 20)

Until April 2015, you have the ability to use the following syntax:
<Result> = GglConnect(Google Connection>)
where <Google Connection> is a gglConnection variable containing the following properties:
NameType used Effect
EmailCharacter stringGoogle email address of user (corresponds to his login).
PasswordCharacter stringConnection password.
ApplicationNameCharacter stringApplication name. This property can correspond to an empty string.
// SYNTAX OBSOLETE FROM APRIL 2015

// Connection
Cnt is gglConnection
Cnt..Email = "vince@gmail.com"
Cnt..Password = "azerty"
Cnt..ApplicationName = "MyApp-03"
IF GglConnect(Cnt) = False THEN
Error(ErrorInfo())
END
Minimum required version
  • Version 14
This page is also available for…
Comments
Click [Add] to post a comment