|
|
|
|
|
- Properties specific to 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
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 changed using different WLanguage properties. Remark: For more details on the declaration of this type of variable and the use of WLanguage properties, see Declaring a variable. // 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 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.
- Validate
- 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 websites, select "Web application". In the "Authorized redirection URI" area, enter the address of the Web server where your site is installed followed by "/WD300AWP/WD300Awp.exe/GGLCONNECT_RETURN". The syntax has the following type:
http[s]://<Nom_ou_IP_Serveur>[:<Port>]/WD300AWP/WD300AWP.exe/GGLCONNECT_RETOUR For example: - In test mode, with a Web server configured on the default port (80):
http://localhost/WD300AWP/WD300AWP.exe/GGLCONNECT_RETOUR - In test mode, with a Web server configured on port 8080:
http://localhost:8080/WD300AWP/WD300AWP.exe/GGLCONNECT_RETOUR - In Internet deployment, with a Web server configured on the default port with "www.mydomain.com" as domain:
http://www.mondomaine.com/WD300AWP/WD300AWP.exe/GGLCONNECT_RETOUR - In Internet deployment, with a Web server configured in https on the default port (443) with "www.mydomain.com" as domain:
https://www.mondomaine.com/WD300AWP/WD300AWP.exe/GGLCONNECT_RETOUR - In Intranet deployment, with a Web server configured on port 81 with "IntranetServer" as computer name:
http://ServeurIntranet:81/WD300AWP/WD300AWP.exe/GGLCONNECT_RETOUR
- Validate. The client identifiers are created:
- Client identifier. This identifier must be stored. It will be used in the gglConnection variable.
- Client secret code. This identifier must be stored. It will be used in the gglConnection variable.
Redirection URI. Check whether "http://localhost" is specified.
Connection persistence 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 sFichierPersistanceAuth = SysDir(srLocalAppData) + [fSep] + "authggl.xml"
cnx is gglConnection
IF fFileExist(sFichierPersistanceAuth) THEN
let bufDésérialise = fLoadBuffer(sFichierPersistanceAuth)
Deserialize(cnx, bufDésérialise, psdXML)
ELSE
cnx.Email = "email@gmail.com"
cnx.ClientID = "387756281032-qffa6dajjd5348iqhi558xxxxxxxx.apps.googleusercontent.com"
cnx.ClientSecret = "Sxxxxx-jLMwwh"
END
IF GglConnect(cnx, gglServiceCalendar) THEN
bufSérialise is Buffer
Serialize(cnx, bufSérialise, psdXML)
fSaveBuffer(sFichierPersistanceAuth, bufSérialise)
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 as parameter.
| | GglConnect | Manages authentication on a Google server (via the "OAuth 2.0" authentication mode). | GglDelete | Deletes data from the Google server. | 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. | 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. | GglGetCalendar | Retrieves a Google calendar and its events according to its title or identifier. | GglGetDocument | Downloads a document from the Google Docs service. | 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. | GglListContactGroup | Retrieves the list of groups of contacts associated with the specified Google account. | GglListDocument | Retrieves the list of documents available on the Google server for the current user. | GglRequest | Sends a communication request (HTTP request) to a Google service. | GglUploadDocument | Uploads a document to the Google server. | GglWrite | Creates and/or updates data on the Google server (addition or modification of data). |
Functions (prefix syntax) that handle gglConnection variables
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|