28 responses to “Codeigniter Facebook Login Tutorial using Facebook PHP SDK

  1. dhishna

    May 30, 2013 at 4:38 pm

    i’m getting this error. can you please help?

    Fatal error: Call to undefined function base_url() in C:\wamp\www\CodeIgniter2\application\views\welcome_message.php on line 1 Call Stack #TimeMemoryFunctionLocation 10.0006260672{main}( )..\index.php:0 20.0032318824require_once( ‘C:\wamp\www\CodeIgniter2\system\core\CodeIgniter.php’ )..\index.php:202 30.03161262312call_user_func_array ( )..\CodeIgniter.php:359 40.03161262392Welcome->index( )..\CodeIgniter.php:359 50.03161262568CI_Loader->view( )..\welcome.php:22 60.03161263320CI_Loader->_ci_load( )..\Loader.php:419 70.03211289992include( ‘C:\wamp\www\CodeIgniter2\application\views\welcome_message.php’ )..\Loader.php:833

    • Rajitha

      May 30, 2013 at 8:53 pm

      Hi, Please check you have loaded ‘url’ library. You may autoload this library.

    • a

      January 13, 2016 at 3:37 pm

      go to application/config/config.php

  2. magazzinaggio

    June 13, 2013 at 2:27 pm

    Continuate cos, bravi!

  3. debora

    June 14, 2013 at 3:34 am

    Info Molto utile. Spero di vedere presto altri post!

  4. miguel

    August 16, 2013 at 12:07 am

    mmm i have a problem the image doesnt appear

  5. Sanny

    October 1, 2013 at 3:16 pm

    Thanks for your post , but how do i retrieve the Logged in user data from backend function ..

    • Rajitha

      October 1, 2013 at 5:41 pm

      Thanks Sanny.
      I think you need to retrieve information from the database of the loggedin user. If this is the case first find redirect(‘/fb/test’); line in Fb controller. Here we redirect the verified user to Test controller. Before redirecting you can fetch user information from the database using $user_id which we already have. You can create sessions to store necessary data. This code may include in a User model. After everything is ok, you can redirect him as mentioned earlier.

  6. sanjay

    May 20, 2014 at 7:44 pm

    logout is not happening? what to do?

  7. sanjay

    May 20, 2014 at 7:45 pm

    when i click on logout buttong, it redirect to facebook home page

  8. খান

    September 27, 2014 at 12:02 am

    it seems unfinished tuts. no sequences. I think you copied from another place.

    • Rajitha

      September 27, 2014 at 1:53 pm

      Not really. Extracted this code from one of my ongoing projects at that time. So it might be incomplete and need to organize. I didn’t mean rework.

  9. hellboy

    October 13, 2014 at 4:43 pm


    what content should I write in facebook.php file?
    or from where should I take this file?

    • Rajitha

      October 14, 2014 at 8:34 pm

      please check the source code which you can download.

  10. Trailers in buffalo missouri

    October 17, 2014 at 11:53 pm

    You need to take part in a contest for one of the best sites online.
    I most certainly will highly recommend this web site!

  11. vijay

    October 27, 2014 at 5:03 pm

    hey guys, can any1 help me how to insert data of user who successfully logs FB?? I can able to get info using alert but don’t hav idea how to insert….

  12. Pushpendra Sharma

    November 13, 2014 at 4:18 pm

    i am not able to download this

    • Rajitha

      November 13, 2014 at 5:09 pm

      Sorry for the inconvenience. We ‘ll update links soon.

  13. toko keramik murah

    November 25, 2014 at 10:45 am

    Article writing is also a fun, if you be acquainted with afterward you
    can write otherwise it is complicated to write.

  14. freddysidauruk

    September 8, 2015 at 5:13 pm

    been working on it, hard to get data users login to insert it to database, if any tutorial register also login using facebook will big thanks 😀

    • Rajitha

      September 8, 2015 at 7:41 pm

      Thanks for reading my tutorial. I’m not sure whether you ‘re fine with that. Anyway, I recommend you to find any recently published tutorials for this subject.

  15. afzalur

    October 5, 2015 at 9:08 pm


  16. amygodo

    January 11, 2016 at 10:18 pm

    hello how i can use user_photos in api this is my code $user_fre = $facebook->api(‘/me/photos?limit=2&type=uploaded’); and get output list photos

    • Asha Vaghela

      May 6, 2016 at 5:56 pm

      i m getting user id bt not getting any user data.
      $user_profile = $facebook->api(‘/me’);
      this line is not work for me.


    June 13, 2016 at 5:46 pm

    can not find where to download code

    • Rajitha

      June 13, 2016 at 5:48 pm

      Please use a recently published tutorial. This might be outdated.

  18. venkat

    June 15, 2016 at 10:41 pm

    Hi, there is no link for download. Pls send download link..

  19. Milind Wagh

    April 3, 2017 at 4:08 pm

    this code shows me blank page after login with fb/test link

    fb/test=facebook_login/fblogin both are same


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: