Skip to Content

Configuring Facebook

Vinyl does not natively support Facebook's Graph API, either as an authentication or data provider. However, since the Facebook Graph API can be consumed as a REST API, secured using the OAuth Client Credential flow, it's possible use Vinyl's generic HTTP security provider to retrieve data from Facebook.

Facebook's documentation for using the OAuth Client Credentials flow can be found here:

https://developers.facebook.com/docs/facebook-login/access-tokens#apptokens

The main tasks involved include:

  1. Register Vinyl as a Facebook application.
  2. Create a Facebook HTTP security provider
  3. Create a Facebook data source.

It's assumed that your organization already has an existing Facebook account. Furthermore, it's assumed that the organization has registered as a Facebook application developer.

Register Vinyl as a Facebook Application

Start by signing into the Facebook App Dashboard.

https://developers.facebook.com/apps/

  1. Click the Add a New App button.
  2. Provide the following information:

    • Display Name: A logical name for the Vinyl environment or application.

      Example: Vinyl

    • Contact Email: Your email address.

    • Category: Business
  3. Click the Create App ID button.

  4. Select Dashboard from the menu.
  5. Click the Show button beneath App Secret.
  6. Make a note of the following properties:

    • App ID: This will be the value of the ClientId when configuring the HTTP security provider within Vinyl.
    • App Secret: This will be the value of the ClientSecret when configuring the HTTP security provider within Vinyl.

Create a Facebook HTTP Security Provider

To create an HTTP security provider, start by signing into Vinyl as an administrator.

  1. Navigate to the IDE
  2. Select the Security Providers button
  3. In the Data Source Authentication panel, click the + Data Source Authentication button
  4. Provide the following:

    • Name: Facebook
    • Type: HTTP
    • Enabled: Check
    • Authentication Type: Client Credentials
    • Click the Save button
  5. Set the following properties. In the Properties panel, click the + Property button → Select the Parameter → Provide the Value → Click the Save icon.

    • AuthenticationType: ClientCredentials
    • TokenEndpoint: https://graph.facebook.com/v2.8/oauth/access_token
    • The token endpoint must contain the version number. The version must be 2.0 or greater. At the time of writing, 2.8 is the current version of the Facebook Graph API.
    • ClientId: The {App ID} provided by Facebook
    • ClientSecret: The {App Secret} provided by Facebook

Create a Facebook Data Source

To create a Facebook data source, start by signing into Vinyl as an administrator.

  1. Navigate to the IDE
  2. Click the Data Servers button
  3. Click + Server
  4. Provide the following:

    • Server Name: Facebook
    • Type: REST API
    • Sub Type: REST
    • URL: https://graph.facebook.com/
    • Request Content Type: JSON
    • Response Content Type: JSON
  5. Expand Security Settings, set Security Provider to the Facebook value configured in prior step

  6. Click Save
  7. Click the Tables icon from Server Settings to configure the Endpoints information
  8. In the Endpoints panel, click the + Endpoint button
  9. Provide the following:

    • Name: Page
    • Endpoint: {{Page}}?fields=fan_count
  10. Click the checkmark icon

  11. In the Endpoint Parameters panel, click the + Parameter button
  12. Provide the following:

    • Name: Page
    • Data type: String
    • Test value: zudysoftware
  13. Click the Save button

  14. In the Endpoints panel, click the Discover button and click Discover again

    This import process will populate the SQL Results panel.

  15. In the SQL Results panel, locate the Page table and click the Results icon.

Assuming everything has been configured correctly, you should see follower count for the zudysoftware Facebook account.

Troubleshooting

Error: "Unexpected character encountered while parsing value: a. Path '', line 0, position 0."

This indicates that the response body was not serialized as JSON. Ensure that the token endpoint contains a version number at that the version is greater than 2.0.