How to Login and Logout with Facebook, Checking your App with Facebook Login
In this tutorial i am telling you how to login with Facebook and check your App, This is not a proper example for login to your website with Facebook login, It is only a sample to check your first FB App without doing much effort and coding.
I will explain how to sign up with Facebook in upcoming tutorials so for checking your App you can try this you know how to check if you dont know then learn our previous tutorials..
Simple and Quick Facebook App Development Tutorials
The simple code for Facebook login is given below..
In this tutorial i am telling you how to login with Facebook and check your App, This is not a proper example for login to your website with Facebook login, It is only a sample to check your first FB App without doing much effort and coding.
I will explain how to sign up with Facebook in upcoming tutorials so for checking your App you can try this you know how to check if you dont know then learn our previous tutorials..
Simple and Quick Facebook App Development Tutorials
The simple code for Facebook login is given below..
<?php include 'libs/facebook.php'; $facebook=new Facebook(array( 'appId'=>'your app id', 'secret'=>'your app secret', 'cookie'=>true )); $session=$facebook->getUser(); $me=null; if($session) { try { $me=$facebook->api('/me'); } catch(FacebookApiException $e) { echo $e->getMessage(); } } if($me) { $logoutUrl=$facebook->getLogoutUrl(); echo "<a href='$logoutUrl'>Logout</a>"; $session=null; } else { $loginUrl=$facebook->getLoginUrl(); echo "<a href='$loginUrl'>Login</a>"; } ?>
Just Copy the Above code and paste it in your app code then you can easily login with facebook this example is 100% tested...
No comments:
Post a Comment