|
|
|
|
|
- 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 (Variable type) In french: gglConnexion
The gglConnection type is used to describe a connection to the Google services and to manage the authentication to different services. You can define and change the characteristics of this connection using different WLanguage properties. Note: For more details on the declaration of this type of variable and the use of WLanguage properties, see Declaring a variable.
Cnx is gglConnection
Cnx.Email = "email_utilisateur_final@gmail.com"
Cnx.ClientID = "387756281032-qffa6dajjd5348iqhi558dkd98xxxxxx.apps.googleusercontent.com"
Cnx.ClientSecret = "S13DCA6KkYh1EgPv9-jLxxxh"
IF GglConnect(Cnx) = False THEN
Error(ErrorInfo())
END
Properties 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. Warning: This property does not retrieve the email address of the authenticated account. |
Remarks 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]://<Server_name_or_IP_address>[:<Port>]/WD300AWP/WD300AWP.exe/GGLCONNECT_RETURN For example: - In test mode, with a Web server configured on the default port (80):
http://localhost/WD300AWP/WD300AWP.exe/GGLCONNECT_RETURN - In test mode, with a Web server configured on port 8080:
http://localhost:8080/WD300AWP/WD300AWP.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//WD300AWP/WD300AWP.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//WD300AWP/WD300AWP.exe/GGLCONNECT_RETURN - In Intranet deployment, with a Web server configured on port 81 with "IntranetServer" as computer name:
http://IntranetServer:81/WD300AWP/WD300AWP.exe/GGLCONNECT_RETURN
- 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 sAuthPersistenceFile = SysDir(srLocalAppData) + [fSep] + "gglauth.xml"
cnt is gglConnection
IF fFileExist(sAuthPersistenceFile) THEN
let bufDeserialize = fLoadBuffer(sAuthPersistenceFile)
Deserialize(cnt, bufDeserialize, psdXML)
ELSE
cnt.Email = "email@gmail.com"
cnt.ClientID = "387756281032-qffa6dajjd5348iqhi558xxxxxxxx.apps.googleusercontent.com"
cnt.ClientSecret = "Sxxxxx-jLMwwh"
END
IF GglConnect(cnt, gglCalendarService) THEN
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 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 previously retrieved: the events corresponding to the calendar are retrieved (by using criteria if necessary). | GglFillCalendarByRequest | Fills a calendar that was previously retrieved: the events corresponding to the calendar are retrieved via a custom query. | GglGetCalendar | Retrieves a Google calendar and its events according to its title or identifier. | GglGetDocument | Downloads a document from Google Docs. | 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…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|