PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
This content has been translated automatically. Click here to view the French version.
  • 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
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: gglConnection
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 using different WLanguage properties.
Remark: See Declaring a variable for more details on the declaration of this type of variable and the use of WLanguage properties.
Example
// Connection
Cnt is gglConnection
Cnx.Email = "Email_utilisateur_final@gmail.com"
Cnx.ClientID = "387756281032-qffa6dajjd5348iqhi558dkd98xxxxxx.apps.googleusercontent.com"
SecretClient = "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.
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.
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.
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
        Allows you to authenticate to a Google server (via the "OAuth 2.0" authentication mode).
        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
        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
        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
        GglListCalendar
        New in version 14
        GglListCalendar
        GglListCalendar
        Retrieves the list of Google calendars associated with the specified Google account.
        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
        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>.ConnectAllows you to authenticate to a Google server (via the "OAuth 2.0" authentication mode).
        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>.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>.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>.ListCalendarRetrieves the list of Google calendars associated with the specified Google account.
        <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>.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>.ConnectAllows you to authenticate to a Google server (via the "OAuth 2.0" authentication mode).
        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>.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>.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>.ListCalendarRetrieves the list of Google calendars associated with the specified Google account.
        <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>.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>.ConnectAllows you to authenticate to a Google server (via the "OAuth 2.0" authentication mode).
        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>.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>.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>.ListCalendarRetrieves the list of Google calendars associated with the specified Google account.
        <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>.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).
        Minimum version required
        • Version 14
        This page is also available for…
        Comments
        Click [Add] to post a comment