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

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

< 1 Minute Read

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
1 Comment
  • Avatar
    Butters
    Posted at 19:56h, 04 May Reply

    Esto sale: La URL proporcionada no está permitida por la configuración de la aplicación.: Una o más de las URL proporcionadas no está permitida por la configuración de la Aplicación. Debe coincidir con la URL del Sitio Web o la URL Canvas, o el dominio debe ser un subdominio de uno de los dominios de la Aplicación. Valla mierda!

Post A Comment

Exit pop up

Sad to see you leaving early...

From "Aha" to "Oh shit" we are sharing everything on our journey.
Enter your email address to stay up to date with the latest news.
Holler Box