Step by Step guide to integrate Facebook API using java

In this section, I will provide you step by step guide to integrate Facebook API using java. It would be very easy to implement Facebook API  but for that we need to follow certain steps in proper sequence.

Step 1  :  Create account on Facebook website. http://facebook.com/
Step 2  :  Login into your account on Facebook.
Step 3  :  Now go to following URL : https://developers.facebook.com
Step 4  :  You will find app tab in top menu, click to continue or directly go to following URL https://developers.facebook.com/apps  
Step 5  :  Now click on create new App.
Step 6  : This will open new model dialog box and ask you for app name. Please provide unique application name. skip rest of the details and click on continue.
Step 7  : This will redirect you to show list of registered application now click on edit settings. This page is very very important because it provides your application id (app-id) as well as application secret(app secret). Copy both app-id and app-secret to another file and save it. both credentials are required to communicate with Facebook API.
Now go under following section: Select how your app integrates with Facebook
and select Website with Facebook Login and provide Site URL path to your local web application path (in my case)  like :  http://localhost:8084/FBAPI
and make sure that you have enabled sandbox mode and save changes. 
That's it . There are many other settings but they are optional, you can set them as per your requirement. 
Step 8 : Now last and final step to set Facebook API to work. Getting an access token. Access token perform very important role while communicating with Facebook API. Without an access taken, it was not possible to get any information from Facebook API. These is a only step where people gets confused where to get an access token of our application. Don't worry I have provided steps to get an access token of your application.
Step 9 : Go to https://developers.facebook.com/tools/explorer
Facebook provide very powerful utility to get an access token of your application and provide a very dynamic feature to access Graph API on the fly.
We will discuss it later on. Now when you open above link you will find your list of application in selection box. Now select proper application if you have more then one application in your account otherwise no need to select any application. once you select application, now click on Get Access Token button to continue.
These will open new pop up box to select list of permission your application will be required from user to access their private data.
select permission details as per your requirement and finish it.
You will see your generated token inside the text box.
Note : Always keep in mind that if you change your permission, you request token gets changes accordingly so after every modification in permission you will get new access token. Access token plays very important role to communicate with Facebook, we have to send access token as parameter on each request.

  


posted under , |

0 comments:

Post a Comment

Please provide your valuable comment.

Newer Post Older Post Home

Followers

Powered by Blogger.

Populares

Custom Search