(How to series) Configure Facebook module

Written by

One of the most important parts of an app is, without a doubt, its content. You have to add interesting information for the users, otherwise they will never find it useful for their purposes and that means the death of the App. Including access to social networks is a good start for visits to become recurring. So today we will explain how to configure one of the most recurring modules at King of App: Facebook.

We all know social networks are key to get loyal followers. In our modules market we offer you all kind of access for you to choose the most convenient one. On today’s tutorial we will choose Facebook module. With it App users will have access to the news feed of the page you chose.

Once loaded on our desk, it’s time to configure it. You will have to click on the “Edit” icon. Logical, right? Then a tab will appear, where you must add some information. The first one is to name the module (you must decide how you want users to see this module). If you do not change anything it will look like a generic “Facebook feed.” Edit it as you like, baptise it!

Once you have named the module you will have to fill the actual configuration data. On one side you will be required to enter the ID of the page. That means copying the URL of the page. Normally all of them are something like this: http://www.facebook.com/pages/Name_of_the_Page. With this, we can locate it and know where we should go to get the information.

The other thing is more complicated because it requires a first step; it is the token acces. This code is necessary for us to access the data feed page. It is like an access key. Where do you get it from? Very simple, you must follow the steps that Facebook has on its Developers page: https://developers.facebook.com/docs/facebook-login/access-tokens On this link you will find all the information necessary to get this data.

However, as you might no have the time nor the patience, developers as Cesar Mancilla explains all this step by step on his blog (http://cesarmansilla.com/blog):

Step 1: “Get a User access token”

  1. Go to the Graph API Explorer: https://developers.facebook.com/tools/explorer/
  2. Select the application that ww will work with from the dropdown menu
  3. Click on the “Get Access Token” button
  4. A window will open, go to the tab “Extended Permissions” and tick “manage_pages” and optionally all those which seem necessary for our program
  5. Click on “Get Access Token”. We will obtain the token string in the text field.

Step 2: “View pages access token of fanpages we manage”

  1. In the field to execute Facebook API calls we will type: “me / accounts”
  2. Click “Submit”
  3. We will obtain a list of fanpages we manage, we need to find the one we will work with and copy the value of “access_token”

This Page access token expires after one hour, so now we will explain how to do it with a method that never expires:

  1. We will need an user access token (have a look again at step number one)
  2. We need the “App Secret”. Go to the dashboard of your application, click on the “Show” button next to the field “App Secret”. It will ask for your password to display the field. You will also have your “App ID”
  3. These three data must be replaced at the following URL: https://graph.facebook.com/v2.0/oauth/access_token?grant_type=fb_exchange_token&client_id=[APP-ID]&client_secret=[APP-SECRET]&fb_exchange_token=[USER-ACCESS-TOKEN]
  4. Once replaced data, paste it into a browser and press enter, there we will see a string known as “Long lived User Access Token” that expires in two months.
  5. Copy this token, paste it in the “Access Token” field in the Graph API Explorer and do what we just explain in step 2 to obtain a Page Access Token that never expires.

Once completed all three fields, we have a Facebook module fully configured and ready to use in the App.

Easy, right?