Sample Facebook Application

Recently we were assigned to make a facebook application as a part of an assignment using Oauth. The one mentioned here is a basic application that will gather some basic information from the user profile, upatade it on a predefined image and post it on to Facebook.

The Use Case Diagram for the scenario is as follows


what is OAuth?

OAuth, which is pronounced “oh-auth,” allows an end user’s account information to be used by third-party services, such as Facebook, without exposing the user’s password. OAuth acts as an intermediary on behalf of the end user, providing the service with an access token that authorizes specific account information to be shared. The process for obtaining the token is called a flow.

Now lets set up the application


  1. A server- I am currently using xampp on localhost
  2. Facebook PHP SDK
  3. PHP Composer

Now that we have the prerequisites set up

step 1

Head over to and set up your application there

select add a new app


Give in a name to the app and hit create app ID


After giving your app a name. Head over to app review and make app public to access features such as email, public profile and public friend list. If you need further permission submit the application for a review.


After setting up the application go to the root directory  and run the following command and it will create a folder named vendor in your folder

  1. composer require facebook/graph-sdkvendor.JPG
  2. Create two files call login.php and callback.php. In login.php file we will authenticate the user with Facebook servers and in fb-callback.php we will pass the access token of user and get the user details from Facebook servers

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Powered by

Up ↑

%d bloggers like this: