King of App

(How to series) Setting up the Facebook module

One of the most important parts of an App is, without a doubt, its content. You have to put things in it that interest the user, otherwise they will never find it useful for their purposes and that means the death of an App. Including access to social networks is a good starting point for making visits to an App a recurring thing. Therefore, today we are going to explain how to configure one of the most recurring modules in King of App: Facebook.

It is well known that social networks are a key element for building loyalty, so in our module market we offer you all kinds of access to the main ones, so you only have to choose the one or ones that suit you best. In today's case, we will choose the Facebook module. With it, App users will have access to the news feed of the page you choose.

With the module loaded on our desktop, it’s time to configure it. To do this, you’ll have to click on the “Edit” icon. Logical, right? A tab will open in front of you where you’ll have to add a series of data. The first of these is to name the module. That is, you must decide how you want users to see this module. If you don’t touch anything, it will look like a generic “Facebook feed.” Edit it as you feel most comfortable, name it.

Once you have chosen the name of the module, it is time to enter the actual configuration data. On the one hand, you will need to enter the page ID. This means copying the destination URL of the page. Normally, they all follow the following scheme: https://www.facebook.com/pages/Page_Name. With this, we will be able to locate it and know where we should go to look for the information.

The other piece of information is a bit more complicated because it requires a previous step: the access token. This code is necessary so that we can access the data in the page feed. It is, to make it easier to understand, an access key. Where do you get it from? Very simple, you have to follow the steps indicated by Facebook on its developer page: https://developers.facebook.com/docs/facebook-login/access-tokens In this link you will find all the information necessary to obtain this information.

However, as you probably don't have the time or patience, developers like Cesar Mancilla on his blog (https://cesarmansilla.com/blog) explain it to us step by step:

Step 1: “Obtain a User access token

  1. Go to the Graph API Explorer: https://developers.facebook.com/tools/explorer/
  2. Select the application you want to work with from the drop-down menu
  3. Click on the “ buttonGet Access Token
  4. A window will open, go to the “Extended Permissions"and we must check the permission"manage_pages"and optionally all those that we consider necessary for our program
  5. Click on “Get Access Token“. We will get the string with the token in the text field.

Step 2: “Check the pages access token of the fan pages we manage

  1. In the field to execute calls to the Facebook API we will write: “me/accounts
  2. Click on “Submit
  3. We will get a list of fanpages that we manage, we must search for the one we are going to work with and copy the value of “access_token

This Page access token expires after 1 hour, so now we move on to the method to get one that never expires:

  1. We need a User access token, we can obtain it with step 1 seen above.
  2. We need the “App Secret“. We enter the dashboard of our application, click on the “Show” button next to the “App Secret” field. It will ask us for our password to show the field.
    • Here we will also have our “App ID
  3. These 3 data must be replaced in the following URL as appropriate: 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 the data has been replaced, we paste it into a browser and press enter, there we will see a string known as “Long-lived User Access Token" which expires in 2 months.
  5. We copy this token, paste it into the field “Access Token" in it Graph API Explorer and we do what was explained in step 2 to obtain a Page Access Token that never expires.

With the three fields duly completed, we now have the Facebook module fully configured and ready to be used in the App.

Easy, right?

 

 

Share

en_USEnglish