Facebook Login Migration (Using PHP SDK (v3.0.0))

Facebook Login Migration (Using PHP SDK (v3.0.0))

PHP1If you are doing migration from v2.2.x to v3.0.0

You need to do the following changes.

  • Download SDK: https://github.com/facebook/facebook-php-sdk
  • Keep the two classes base_facebook.php and facebook.php with the certificate fb_ca_chain_bundle.crt
  • Include facebook.php in your php file.
  • If you’re currently using the PHP SDK (v2.2.x) for authentication, you will recall that the login code looked like this:
include_once("facebook.php"); OR include_once("base_facebook.php");
$facebook = new Facebook(…);
$session = $facebook->getSession();
if ($session) {
// proceed knowing you have a valid user session
} else {
// proceed knowing you require user login and/or authentication
}
  • The login code is now:
include_once("facebook.php");
$facebook = new Facebook(…);
$user = $facebook->getUser();
if ($user) {
// proceed knowing you have a logged in user who's authenticated
} else {
// proceed knowing you require user login and/or authentication
}

I hope you like this post and if you want to get such type of updates then please subscribe our email. You can also visit our PHP/CakePHP portfolio page to see all our apps developed on php or cakephp platform.

Tags:
,
Avatar
Mahavir S. Senapati
mahavir.senapati@andolasoft.co.in