An example of integrating facebook login into a simple php website using Facebook PHP SDK
This socialauth-facebook-login is a plugin developed to allow users to login into your website using Facebook's login option. users can directly clone this repository or download as a Zip file and can include in regular projects.
-
First create a Facebook developers account if you don't have one by going to Facebook developers.
-
After creating developer account, go to your apps section and create a new app b following the steps mentioned there.
-
After creating an app, you can see the app ID on top left. Click on it to copy the app ID, we need it later.
-
Now go to the settings and you can see app secret, it will be hidden. Enter your facebook password to see the app secret.
-
Copy the secret key and keep app ID & SECRET KEY in safe place.
CLONE THE REPOSITORY
- Now clone this repository by using zip download or using https options.
- Now open config.php file and place your app's APP ID & APP SECRET KEY wherever it is mentioned.
- Edit the same in fb-callback.php file and also make sure to put the app ID in the file at 54 line.
START THE SERVER
- Start the server and go to the web browser.
- In the browser, enter http://localhost/socialauth to see the result.
- If you can see the link and a login button, u did it correct.
- Click on the login button to see your name, email and id.