How To Build Facebook Application Using Google App Engine:
You need following:
- A facebook account.
- A Google account.
- The Eclipse IDE with the GAE plug-in has installed.
- You need 'restfb-1.6.11.jar',Get it from here.
The first step is to register your application on both Face book and GAE. It's a good way to create the application on both platforms at the same time to ensure that the information you enter matches up as needed.You need to create a new app in your facebook, Way of creating new app in facebook
You will get following window
Fig : 1
If you are creating facebook app first time you need to register in Facebook Developers site
To register in Facebook Developers site follow the screen shots :
Fig 2 :
You will get following window when you hit on login button
After click on Register Now the following window will appear
Fig 4 :
This is the important step because your are developing your own facebook app, so for security reasons you need to verify your account
After hit on verify your account the following window will appear
Fig 5 :
If you not added any number of you in your facebook account when you creating your facebook account don’t worry be cool it’s so simple see following:
When you click add
Fig 8 :
Finally you will get following page when you successfully added your number and logged—in
Fig 10 :
Fig 11 :
Fig 12 :
Hold on here
Here the explanation about the above red marked fields
1 red mark field--> To fill the first red marked field you need to have Google Ape Engine account, following the way of creating Google app engine account.
Register the application with GAE
Open the link: https://appengine.google.com/ Sign in on the applications page on GAE— and click Create Application button the following window will appear.
Click Create Application to complete the GAE registration process.
See the above fig there is a name called appoffacebook.appspot.com, this is what you have to fill in the 1st red mark field. See the above fig 12 for 1st red mark field.
2nd & 3rd red mark fields
To fill up the 2nd and 3rd red mark fields which are in fig 12, follow the fig.
In the above fig site url is same name of app domain name including http.
How to develop application using Google App Engine?
Next thing you need to develop application using Google App Engine plugin in eclipse, to know how to develop Google App Engine Application creation in Eclipse..
See below there is a web.xml fig, the selected names one is from above fig and the second one is from web.xml which is in our application, those should be match because when we login to face book, facebook redirect the url to our application, by making use of that url it goes to appropriate class.
Add the following line to appengine-web.xml:
HOW TO RUN THE APPLICATION:
Deploy the project into Google App Engine, to know the Deployment process see below link.
After deploying the application open https://appengine.google.com/ you will get following page
When you click on our app link , the following page will appear.
Next click on the application setting, you will get another window see below
Click on Application Default Version URL :
You will get your project (application) index page which you write.
This window will appear when you click on that link
Enter your username and password to get friends list form your account
After finishing login you will get the following window directly
Here is the process how our application getting our friends list :
When you click the link which is displaying when our application runs (see the fig 19).
- Our application sends the request to facebook login page with the app key id.
- When we login to our facebook book, facebook send the
response with the access token to our application (in our
code(index.html) see there is a link with redirect_uri=“
(this is url, when the response come from facebook )”). using that url it goes to our web.xml file and checks whether there is any url with name, and goes to specific servlet class.
- The servlet class getting the friends list from our account. And displaying friends list in FriendsList.jsp.