|
|
|
|
|
- Overview
- Elements available in WLanguage
- Registering the application on Facebook
- Registering a WINDEV application on Facebook
- Configuring Facebook authentication in WINDEV, WINDEV Mobile and WEBDEV
- Establishing the connection
- Using the Facebook API
Using Facebook authentication
Facebook is the world's most popular social network. It is commonly used by companies to reach their customers. Facebook includes a very powerful API to take full advantage of the platform. WINDEV, WEBDEV and WINDEV Mobile include two modes to use Facebook for Android and iOS applications: - a simple mode that allows users to use their Facebook credentials to log in to the WINDEV or WINDEV Mobile application, or to the WEBDEV website. Users don't need to set a new password.
- an advanced mode to interface with Facebook in order to use the Facebook API from a WINDEV or WINDEV Mobile application, or from a WEBDEV website.
The principle is the same regardless of the selected use mode. You need: - Register the WINDEV or WINDEV Mobile application, or the WEBDEV website on Facebook.
- Use Facebook login credentials in the WINDEV or WINDEV Mobile application, or in the WEBDEV website.
- Log in to Facebook from the WINDEV or WINDEV Mobile application, or from the WEBDEV website to authenticate.
For the advanced mode, you can use different WLanguage functions that allow you to interact with Facebook via its API. Please note: This feature is not available for WINDEV applications running on Linux. Elements available in WLanguage The following WLanguage elements can be used to communicate with Facebook: - the fbSession type. This type of variable contains all the elements required to implement the Facebook connection and authentication .
- several functions:
Registering the application on Facebook Configuring Facebook authentication in WINDEV, WINDEV Mobile and WEBDEV Establishing the connection To log in to Facebook, you must: - Configure a Facebook session (fbSession variable). In the different proprerties of this variable, you must specify:
the "App ID" and the "App secret" provided when registering the application on Facebook.
- Establish the connection with FBStartSession.
For example:
MaConnexion is fbSession
MaConnexion.AppID = "1664XXXXXXXXXXXX"
MaConnexion.AppSecret = "c6e7XXXXXXXXXXXXXXXXX"
MaConnexion.Permission = [fbEmail, "manage_pages", "publish_pages", "publish_actions"]
FBStartSession(MaConnexion)
If the connection is permanent, the function does not show a login screen and opens the session directly. Remarks: A Web page is displayed in the default browser, allowing users to enter their login credentials. - An open Facebook session is persistent: it will remain open:
Using the Facebook API FBRequest is used to sent requests to Facebook. The following example lists the pages and groups managed by the current user: sURL is string ANSI = GRAPHAPI + "me/accounts?locale=fr_FR"
sJSON is string ANSI
vJSON is Variant
sJSON = FBRequest(MaConnexion, sURL)
vJSON = JSONToVariant(sJSON)
The function returns the JSON response from Facebook.
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|