CodeIgniter has great documentation, and a great community, and so whenever I need to figure something out, usually someone else has had the same question as me, and someone else has already answered it.

Not so with my recent problem. I wanted to use Facebook Connect, including Facebook's Graph API on an existing site I had already built last year using CodeIgniter. I tried to figure it out myself, gave up after a couple of days, and started looking to see if someone else had a solution. I found a Facebook library for CodeIgniter written by Elliot Haughin. But I kept getting error messages when sessions expired, and even when I wasn't getting error messages, I could only do half of what I needed the solution to do.

Oh, by the way, here's what I needed the solution to do:

I was able to get logging-in working with Elliot Haughin's library, but I couldn't figure out how to get a user's friends' names and photos. And I didn't want to figure out the error messages I was getting.

Don't get me wrong. I don't mean to talk ill of Elliot Haughin. Looking at his site, it's obvious to me that the guy is smarter than me. It's just that I couldn't get his solution to work for my site.

After giving up on Elliot's library, I went back to trying what I was doing before. Eventually I got it working correctly. And since, as far as I know, there aren't any other tutorials explaining how to do it the way I did, I decided to write this tutorial to give back to the CodeIgniter community that has helped me out so well over the past 18 months or so.

I'll try to make this easy enough for someone as dumb as me to understand. If you are following along with this tutorial, I'm assuming you already can do the following:

Go to page 2


Roee Aizman

15 August 2010 4:08 pm

Hello kent

I found your great tuturials and first of all thanks.

I have problems seeing the connect screen and also the return args does not work and blank array is coming back. I read Eric's problem and i also deleted the previous library i had (of the other tuturial)and also added openssl to my php and activated ssl on my apache.

No help.

I am useing WAMP server to demonstrate it.

Can you help me? Thanks.

Roee A


17 August 2010 11:56 pm


Having scoured for ways to implement FB Connect with Code Igniter, I was really impressed by your steps. But, the test1 page keeps reloading for me continuously. I'm quite sure that it has something to do with the cookie not not getting stored. Would you happen to know why? Have you come across such an issue?

In fact, I tried your files on a fresh installation of code igniter,xampp and wamp.



24 August 2010 10:29 pm

Hello, Can i know how to integrate the facebook like button in my site with (codeigniter). Thanks priya


25 August 2010 4:55 pm

The Facebook like button is very easy, and you can just add the code to the view. Get the code here:

Your comment will appear once it is approved.

  • (required)
  • (required - will not be published)
  • (optional)