Login with facebook account using php

| Last Updated: | In: Facebook, PHP Tutorial


Nowadays every website has the feature of social logins like Facebook, Twitter, Google Account and more. I got the lots of tutorial request to create a sample code to login with facebook account using the PHP. In this tutorial, I will explain how to log in with the Facebook account using PHP with example and you can also download the complete code. I have added the download link at the end of this tutorial.

Login with Facebook makes easy to connect with users or peoples using Facebook applications for your website. The Facebook SDK for Javascript provides a simple path to integrating users to log in to your websites.

It’s provides these common scenarios:

1) Your application uses Facebook Login to authorize users.
2) It’s also provides two login options: Facebook Login and your own website custom login.

Create Database Table

Sample users table columns id, email, and username.

Facebook Application Setup

Go to the https://developers.facebook.com/apps and create app id and app secret id, just modify in the following code
config.php

For the database configuration edit config.php

Create a config.php page and add below code after changing database configurations and save.

Integrate with your index.php page

If you want to change in your web application index page, just use following code.

Download the complete code from here

Thanks for giving your valuable time on FreeWebMentor community and follow on Facebook. If you still any question/queries please feel free to comment in below comment section. Do like & share with your friends if you like this post.


About: Prem Tiwari

Prem Tiwari is the founder of freewebmentor.com and is a professional developer who has vast experience in PHP and open source technologies. Apart from this, he is a blogger by hobby and also he has been a regular speaker of WordPress sessions in various IT Companies.


You may also like:


, , , , , , , ,