How to Login with Facebook and TwitterFacebook and Twitter have become large in the social network world and both networks offering oAuth support. We developed a system for login with Facebook and Twitter. Today internet users not interested to filling the large enrollment forms. This script gives you the capacity to avoid enrollment forms, It Is is easy and really useful to incorporate.
Twitter and Facebook have grown to be big in both networks offering oAuth and the social network world support. If all they must do is login using their present Facebook account visitors will likely be a lot more inclined to become members and participate in your web site.
It uses OAuth and workflow and the authority URL differs somewhat as described below, although the flow is quite similar.

Login with Facebook and Twitter
Please follow below steps to learn and add Login with Facebook and Twitter on your websites easily:
1. Database
Create new database with users table columns id, email, oauth_uid, oauth_provider and username.CREATE TABLE users
(id INT PRIMARY KEY AUTO_INCREMENT,email VARCHAR(70), oauth_uid VARCHAR(200),oauth_provider VARCHAR(200),username VARCHAR(100), twitter_oauth_token VARCHAR(200), twitter_oauth_token_secret VARCHAR(200) );
Create new database with users table columns id, email, oauth_uid, oauth_provider and username.
CREATE TABLE users
(id INT PRIMARY KEY AUTO_INCREMENT,email VARCHAR(70), oauth_uid VARCHAR(200),oauth_provider VARCHAR(200),username VARCHAR(100), twitter_oauth_token VARCHAR(200), twitter_oauth_token_secret VARCHAR(200) );
2. Twitter Setup
Create Twitter application from twitter website and replace Twitter Key & Twitter Secret Key in twconfig.php file as shown below code.<?phpdefine('YOUR_CONSUMER_KEY', 'Twitter Key');define('YOUR_CONSUMER_SECRET', 'Twitter Secret Key');?>
Create Twitter application from twitter website and replace Twitter Key & Twitter Secret Key in twconfig.php file as shown below code.
<?phpdefine('YOUR_CONSUMER_KEY', 'Twitter Key');define('YOUR_CONSUMER_SECRET', 'Twitter Secret Key');?>
3. Facebook Setup
Create Facebook application from facebook website and replace Facebook APP ID & Facebook Secret ID in fbconfig.php file as shown below code.<?phpdefine('APP_ID', 'Facebook APP ID');define('APP_SECRET', 'Facebook Secret ID');?>
Create Facebook application from facebook website and replace Facebook APP ID & Facebook Secret ID in fbconfig.php file as shown below code.
<?phpdefine('APP_ID', 'Facebook APP ID');define('APP_SECRET', 'Facebook Secret ID');?>
4. Databas Configuration
Add your database details in dbconfig.php file as shown below code:<?phpdefine('DB_SERVER', 'localhost');define('DB_USERNAME', 'username');define('DB_PASSWORD', 'password');define('DB_DATABASE', 'database');$db = mysqli_connect(DB_SERVER,DB_USERNAME,DB_PASSWORD,DB_DATABASE);?>
Add your database details in dbconfig.php file as shown below code:
<?phpdefine('DB_SERVER', 'localhost');define('DB_USERNAME', 'username');define('DB_PASSWORD', 'password');define('DB_DATABASE', 'database');$db = mysqli_connect(DB_SERVER,DB_USERNAME,DB_PASSWORD,DB_DATABASE);?>
5. Twitter Login Config
In your root directory you can see login-twitter.php. Edit this file and replace yourwebsite.com to your main domain name.$request_token = $twitteroauth->getRequestToken('http://yourwebsite.com/getTwitterData.php');
In your root directory you can see login-twitter.php. Edit this file and replace yourwebsite.com to your main domain name.
$request_token = $twitteroauth->getRequestToken('http://yourwebsite.com/getTwitterData.php');
Comments
Post a Comment