The importance of implementing the Sign in with Facebook Features
We all know that Facebook is the largest and most popular social media of all, and you can guarantee that all of your visitors do have a Facebook account. And when it takes to get the details of your customers, people do not want to spend time on filling the big sign up forms. This can make a huge bounce backing of a large portion of lazy audience. Now you can implement a better way of collecting the customer details with an easy one click Facebook app allowing feature. You get to store the customer details on your database with this easy step. So let us look how to implement the sign in with Facebook, along examining the required files and its importance.
Easy Steps for Sign in With Facebook feature:
- Download Files
- Create FB app
- Create the table in your database of your website
- Host the files and folder at your server
Step 1: Free Download Files of Sign in with Facebook
We now look the basic php files needed to implement the sign in with Facebook feature on your website. After that you have downloaded the set of files on Sign in with Facebook, you can unzip to get a folder with arranged php files.
On the main folder you will find:
- Index.php the initial web page, where your customer clicks the “Sign in with Facebook”
- Login-facebook.php is used to link Facebook and your website.
- Logout.php take care to operate the functions to log out.
- Home.php is the the logged in page, of the user, that can be modified.
On the other folders you will find
- Base_facebook.php and Facebook.php are the authentication files
- Dbconfig.php – to configure the database
- Fbconfig.php – used to get the customer details from fb by giving fb application details.
- Functions.php – to define the SQL functions
Step 2: Create FB app
You must create an Facebook app by going to the developer section of Facebook at facebook app builder. Fill in the fields accordingly with adding your website URL too.
Once you create the app, you will get an APP ID and SECRET ID, which you need to be added in the files stated above named fbconfig.php in the config folder.
define('APP_ID', '**********'); define('APP_SECRET', '**********************');
Step 3: Create the table in your database of your website
This is where your customer’s details will be stored. To create a separate table, use the following code.
CREATE TABLE users ( id INT PRIMARY KEY AUTO_INCREMENT, email VARCHAR(70), oauth_uid VARCHAR(200), oauth_provider VARCHAR(200), username VARCHAR(100), );
Step 4: Host the folder at your server
Once the files are edited, you are eady to hosted those files in your web server.
You can copy the files to the root directory and change the database accordingly.
<!--?php define('DB_SERVER', 'localhost'); define('DB_USERNAME', 'username'); define('DB_PASSWORD', '*********'); define('DB_DATABASE', 'db name'); $connection = mysql_connect(DB_SERVER, DB_USERNAME, DB_PASSWORD) or die(mysql_error()); $database = mysql_select_db(DB_DATABASE) or die(mysql_error()); ?-->
Tell us What you think of this Sign in with Facebook Feature
Hope you have got easy steps to implement the sign in with Facebook feature on your website. With this your visitors finds it easy to spend more time on the website. Comments and Suggestions welcomed.