PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • Properties specific to the description of gglConnection variables
  • Prerequisites for the OAuth 2.0 authentication
  • Persistence of connection
  • Functions that use a gglConnection variable
  • Functions (prefixed syntax) that handle gglConnection variables
  • 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 to 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.
Remark: See Declaring a variable for more details on the declaration of this type of variable and the use of WLanguage properties.
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.
Remark: 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.
Remark: 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.
Remark: 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.
      • 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.
    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.
        • 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.

      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.
          • 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.
        Versions 20 and later

        Persistence of connection

        During the connection to the Google services, the authentication tokens are not saved. It is therefore necessary to re-login and re-authorize the 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)
        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
        Remark: 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. It is therefore necessary to re-login and re-authorize the 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)
        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
        Remark: 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. It is therefore necessary to re-login and re-authorize the 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)
        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
        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 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 request.
        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
        Uploads 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).
        Versions 24 and later

        Functions (prefixed syntax) that handle gglConnection variables

        <gglConnection variable>.ConnectUsed to perform an authentication beside a Google server.
        Versions 24 and later
        <gglConnection variable>.Delete
        <gglConnection variable>.Delete
        Deletes data from the Google server.
        <gglConnection variable>.DisconnectDisconnects the user from the Google services used. During the next re-connection, the authorizations linked to the Google services will be asked again.
        <gglConnection variable>.FillAlbumFills a Google Picasa album with the data corresponding to the requested options.
        <gglConnection variable>.FillCalendarFills a calendar that was retrieved beforehand: the events corresponding to the calendar are retrieved (some criteria may be specified).
        <gglConnection variable>.FillCalendarByRequestFills a calendar that was retrieved beforehand: the events corresponding to the calendar are retrieved from a custom request.
        <gglConnection variable>.FillPhotoRetrieves the details about the photos found in a Google Picasa album: initial image, comments, tags, thumbnails.
        <gglConnection variable>.GetAlbumRetrieves a Google Picasa album.
        <gglConnection variable>.GetCalendarRetrieves a Google calendar and its events according to its title or identifier.
        <gglConnection variable>.GetDocumentDownloads a document from the Google Docs service.
        <gglConnection variable>.ListAlbumRetrieves the list of "Google Picasa" albums available for the user.
        <gglConnection variable>.ListCalendarRetrieves the list of Google calendars associated with the specified Google account.
        <gglConnection variable>.ListCommentRetrieves:
        • the list of comments saved for the Google client account.
        • the list of comments associated with a photo found in a Google Picasa album.
        <gglConnection variable>.ListContactRetrieves the list of contacts associated with the specified Google account.
        <gglConnection variable>.ListContactByRequestRetrieves a list of contacts from custom parameters.
        <gglConnection variable>.ListContactGroupRetrieves the list of groups of contacts associated with the specified Google account.
        <gglConnection variable>.ListDocumentRetrieves the list of documents available on the Google server for the current user.
        <gglConnection variable>.ListPhotoLists the photos found in the Google Picasa albums corresponding to specific criteria.
        <gglConnection variable>.ListTagRetrieves:
        • 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.
        <gglConnection variable>.RequestSends a communication request (HTTP request) to a Google service.
        <gglConnection variable>.UploadDocumentUploads a document to the Google server.
        Versions 24 and later
        <gglConnection variable>.Write
        <gglConnection variable>.Write
        Creates and/or updates data on the Google server (addition or modification of data).
        New in version 24

        Functions (prefixed syntax) that handle gglConnection variables

        <gglConnection variable>.ConnectUsed to perform an authentication beside a Google server.
        Versions 24 and later
        <gglConnection variable>.Delete
        <gglConnection variable>.Delete
        Deletes data from the Google server.
        <gglConnection variable>.DisconnectDisconnects the user from the Google services used. During the next re-connection, the authorizations linked to the Google services will be asked again.
        <gglConnection variable>.FillAlbumFills a Google Picasa album with the data corresponding to the requested options.
        <gglConnection variable>.FillCalendarFills a calendar that was retrieved beforehand: the events corresponding to the calendar are retrieved (some criteria may be specified).
        <gglConnection variable>.FillCalendarByRequestFills a calendar that was retrieved beforehand: the events corresponding to the calendar are retrieved from a custom request.
        <gglConnection variable>.FillPhotoRetrieves the details about the photos found in a Google Picasa album: initial image, comments, tags, thumbnails.
        <gglConnection variable>.GetAlbumRetrieves a Google Picasa album.
        <gglConnection variable>.GetCalendarRetrieves a Google calendar and its events according to its title or identifier.
        <gglConnection variable>.GetDocumentDownloads a document from the Google Docs service.
        <gglConnection variable>.ListAlbumRetrieves the list of "Google Picasa" albums available for the user.
        <gglConnection variable>.ListCalendarRetrieves the list of Google calendars associated with the specified Google account.
        <gglConnection variable>.ListCommentRetrieves:
        • the list of comments saved for the Google client account.
        • the list of comments associated with a photo found in a Google Picasa album.
        <gglConnection variable>.ListContactRetrieves the list of contacts associated with the specified Google account.
        <gglConnection variable>.ListContactByRequestRetrieves a list of contacts from custom parameters.
        <gglConnection variable>.ListContactGroupRetrieves the list of groups of contacts associated with the specified Google account.
        <gglConnection variable>.ListDocumentRetrieves the list of documents available on the Google server for the current user.
        <gglConnection variable>.ListPhotoLists the photos found in the Google Picasa albums corresponding to specific criteria.
        <gglConnection variable>.ListTagRetrieves:
        • 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.
        <gglConnection variable>.RequestSends a communication request (HTTP request) to a Google service.
        <gglConnection variable>.UploadDocumentUploads a document to the Google server.
        Versions 24 and later
        <gglConnection variable>.Write
        <gglConnection variable>.Write
        Creates and/or updates data on the Google server (addition or modification of data).

        Functions (prefixed syntax) that handle gglConnection variables

        <gglConnection variable>.ConnectUsed to perform an authentication beside a Google server.
        Versions 24 and later
        <gglConnection variable>.Delete
        <gglConnection variable>.Delete
        Deletes data from the Google server.
        <gglConnection variable>.DisconnectDisconnects the user from the Google services used. During the next re-connection, the authorizations linked to the Google services will be asked again.
        <gglConnection variable>.FillAlbumFills a Google Picasa album with the data corresponding to the requested options.
        <gglConnection variable>.FillCalendarFills a calendar that was retrieved beforehand: the events corresponding to the calendar are retrieved (some criteria may be specified).
        <gglConnection variable>.FillCalendarByRequestFills a calendar that was retrieved beforehand: the events corresponding to the calendar are retrieved from a custom request.
        <gglConnection variable>.FillPhotoRetrieves the details about the photos found in a Google Picasa album: initial image, comments, tags, thumbnails.
        <gglConnection variable>.GetAlbumRetrieves a Google Picasa album.
        <gglConnection variable>.GetCalendarRetrieves a Google calendar and its events according to its title or identifier.
        <gglConnection variable>.GetDocumentDownloads a document from the Google Docs service.
        <gglConnection variable>.ListAlbumRetrieves the list of "Google Picasa" albums available for the user.
        <gglConnection variable>.ListCalendarRetrieves the list of Google calendars associated with the specified Google account.
        <gglConnection variable>.ListCommentRetrieves:
        • the list of comments saved for the Google client account.
        • the list of comments associated with a photo found in a Google Picasa album.
        <gglConnection variable>.ListContactRetrieves the list of contacts associated with the specified Google account.
        <gglConnection variable>.ListContactByRequestRetrieves a list of contacts from custom parameters.
        <gglConnection variable>.ListContactGroupRetrieves the list of groups of contacts associated with the specified Google account.
        <gglConnection variable>.ListDocumentRetrieves the list of documents available on the Google server for the current user.
        <gglConnection variable>.ListPhotoLists the photos found in the Google Picasa albums corresponding to specific criteria.
        <gglConnection variable>.ListTagRetrieves:
        • 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.
        <gglConnection variable>.RequestSends a communication request (HTTP request) to a Google service.
        <gglConnection variable>.UploadDocumentUploads a document to the Google server.
        Versions 24 and later
        <gglConnection variable>.Write
        <gglConnection variable>.Write
        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 version required
        • Version 14
        This page is also available for…
        Comments
        Click [Add] to post a comment