- Properties specific to the description of gglConnection variables
- Prerequisites for OAuth 2.0 authentication
- Connection persistence
- Functions that use a gglConnection variable
- Functions (prefix syntax) that handle gglConnection variables
gglConnection (Type of variable)
In french: gglConnexion
type is used to describe a connection to the Google services and to manage the authentication to different services. The characteristics of this connection can be defined and changed using different WLanguage properties.
: For more details on the declaration of this type of variable and the use of WLanguage properties, see Declaring a variable
Cnt is gglConnection
Cnt.Email = "firstname.lastname@example.org"
Cnt.ClientID = "387756281032-qffa6dajjd5348iqhi558dkd98xxxxxx.apps.googleusercontent.com"
Cnt.ClientSecret = "S13DCA6KkYh1EgPv9-jLxxxh"
IF GglConnect(Cnt) = False THEN
Properties specific to the description of gglConnection variables
The following properties can be used to handle a Google connection:
|Name||Type used ||Effect|
|ClientID||Character string||Client identifier given when declaring the application in the Google console. |
|ClientSecret||Character string||Secret code of the client given when declaring the application in the Google console.|
|Email||Character string||Email 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.
Prerequisites for OAuth 2.0 authentication
- Click "Create a project". Give the name of your project. An identifier is automatically proposed for your project.
- The project is created.
- In the menu on the left, click "API and authentication" then "API".
- 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.
- In the menu on the left, click "Identifiers".
- 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.
- For WINDEV applications, select "Installed application", then "Other".
- 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 "/WD270AWP/WD270Awp.exe/GGLCONNECT_RETURN". The syntax has the following type:
- In test mode, with a Web server configured on the default port (80):
- In test mode, with a Web server configured on port 8080:
- In Internet deployment, with a Web server configured on the default port with "www.mydomain.com" as domain:
- In Internet deployment, with a Web server configured in https on the default port (443) with "www.mydomain.com" as domain:
- In Intranet deployment, with a Web server configured on port 81 with "IntranetServer" as computer name:
- 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.
- Redirection URI. Check whether "http://localhost" is specified.
When connecting to the Google services, the authentication tokens are not saved. It is therefore necessary to log in again and allow access to the application each time it is run (i.e. each time 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)
// New connection
cnt.Email = "email@example.com"
cnt.ClientID = "387756281032-qffa6dajjd5348iqhi558xxxxxxxx.apps.googleusercontent.com"
cnt.ClientSecret = "Sxxxxx-jLMwwh"
IF GglConnect(cnt, gglCalendarService) THEN
// Save the connection in order to re-use it later
bufSerialize is Buffer
Serialize(cnt, bufSerialize, psdXML)
Remark: 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 as parameter.
|GglConnect||Manages authentication on a Google server (via the "OAuth 2.0" authentication mode).|
|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.|
|GglWrite||Creates and/or updates data on the Google server (addition or modification of data).|
|GglUploadDocument||Uploads a document to the Google server.|
|GglListCalendar||Retrieves the list of Google calendars associated with the specified Google account.|
|GglListContact||Retrieves the list of contacts associated with the specified Google account.|
|GglListContactByRequest||Retrieves a list of contacts from custom parameters.|
|GglListDocument||Retrieves the list of documents available on the Google server for the current user.|
|GglListContactGroup||Retrieves the list of groups of contacts associated with the specified Google account.|
|GglGetCalendar||Retrieves a Google calendar and its events according to its title or identifier.|
|GglGetDocument||Downloads a document from the Google Docs service.|
|GglFillCalendar||Fills a calendar that was retrieved beforehand: the events corresponding to the calendar are retrieved (some criteria may be specified).|
|GglFillCalendarByRequest||Fills a calendar that was retrieved beforehand: the events corresponding to the calendar are retrieved from a custom request.|
|GglRequest||Sends a communication request (HTTP request) to a Google service.|
|GglDelete||Deletes data from the Google server.|
Functions (prefix syntax) that handle gglConnection variables
This page is also available for…
Click [Add] to post a comment