The Ultimate Guide To Facebook Login Migration Using PHP SDK (v3.0.0)

The Ultimate Guide To Facebook Login Migration Using PHP SDK (v3.0.0)
Social sharing

Facebook is the world’s largest social network with more than 2 billion monthly active users. There are so many users because it is a convenient way for people to connect with friends. The login process is smooth and simple, which makes it very easy for users to sign up and log in.

That’s why different websites such as blogs, news outlets, businesses, organizations, etc. have been integrating Facebook Login into their website by using Facebook Login API. There are more than 500 million people who log into their apps or websites using the same credentials they use on Facebook. It just makes things easier for them and more importantly, it helps businesses build trust among their users by giving them the option to sign in via their existing Facebook account.

Never miss an update from us. Join 10,000+ marketers and leaders.

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

Contents

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 to our email. You can also visit our PHP/CakePHP portfolio page to see all our apps developed on PHP or CakePHP platform.

Your recently viewed posts:

Jayadev Das - Post Author

Do what you do best in – that’s what I’ve always believed in and that’s what I preach. Over the past 25+ years (yup that’s my expertise ‘n’ experience in the Information Technology domain), I’ve been consulting to small, medium and large companies ‘About Web Technologies, Mobile Future as well as on the good-and-bad of tech. Blogger, International Business Advisor, Web Technology Expert, Sales Guru, Startup Mentor, Insurance Sales Portal Expert & a Tennis Player. And top of all – a complete family man!

    Contact Us

    We’d love to help & work with you




    When do you want to start ?


    Enter your email address to stay up to date with the latest news.
    Holler Box

    Orange Exit pop up

    Subscribe for the latest
    trends in web and
    mobile app development
    Holler Box

    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