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
Now that we have the prerequisites set up
Head over to developers.facebook.com 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
- composer require facebook/graph-sdk
- 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