Follow the Simple Steps to integrate Facebook Login with javascript SDK in your website, in 10 Mins.
Step: 1
Add Following html in Web Page
Facebook Login
Step: 2
Add Following javaScript function, and get FACEBOOK_APPLICATION_ID from https://developers.facebook.com/.
var myWindow=null;
function fblogin(){
var appId =FACEBOOK_APPLICATION_ID;/** facebook application id */
var URLAfterAuth = 'http://www.example.com/ajax/fblogin';/* After authentication go to this page **/
var str= window.location.href;
if (myWindow && !myWindow.closed) { //exist and is not closed
myWindow.close();
myWindow=null; //delete the object
}else{
myWindow = window.open('https://www.facebook.com/dialog/oauth?redirect_uri='+URLAfterAuth+'&display=popup&response_type=code&client_id='+appId+'&ret=login', 'mywindow','left=100,top=50,width=500,height=500,toolbar=0,resizable=0');
}
}
Step: 3
Add Following script in ajax/fblogin URL
//Add jQuery File Please wait ....
Step: 4
(After Facebook authentication facebook send user to this URL),
URL: ajax/register
print_r($_POST);//Here will have all details
