Skip to content

Never says logged in. #12

digitalfiz opened this Issue Apr 23, 2011 · 15 comments

10 participants


I am using the latest codeigniter and latest of codeigniter-facebook and I have my app setup but when I click login it goes to facebook then back to my site and still has the login link. I saw a similair issue but it was centered around a WAMP setup. I am on a LAMP setup. You can test it here: I will leave it up and wait for a response

santiph commented Apr 23, 2011

I'm having the exactly same problem.
(You can try it here: I just download the library .zip.. Unzipped it on CI and configured the config/facebook.php file with my app Id and api secret. But nothing happens. The "Login" message still appears.
What's going on?

cdevroe commented Apr 28, 2011

I'm also having this issue. Facebook recognizes that I'm logged in (since it shows that the app is "connected") but the Facebook Library never returns for this: !$this->facebook->logged_in()

I'm also having the exact same issue with @elliothaughin 's Twitter Library for CodeIgniter and since he hasn't supported the Libraries at all I've had to resort to getting Twitter involved. It turns out both of these Libraries are using an older OAuth spec. Once we get the Twitter Library issue resolved I'll try to focus some time on getting this Library up-to-date as well.

golevel commented May 3, 2011

Also having this issue. It always says "login" even though my FB info is showing. I'm on a LAMP stack with everything up to date.


Same issue here. I thought perhaps I needed to enable $config['enable_query_strings'] = TRUE; but that didn't help.

golevel commented May 9, 2011

Use this guide instead:

There's really no reason to use Elliot's package anymore. That guide takes all of 5 mins and works perfectly.

cdevroe commented May 9, 2011

@golevel I have done the same thing. And it works great.


I'm using codeigniter for a facebook app and not only for sign on. Additionally I wanted to have my stuff consistent and use the resources provided by codeIgniter,.
So I just started from scratch with just the Facebook Authentication guide and the OAuth2.0 spec and wrote a new library.
Too bad Facebook is about the only social network yet running OAuth2.0.

cdevroe commented May 15, 2011

@mastacheata Does your Library have any advantages over the workflow that Danny Herran suggests?


@cdevroe The facebook php sdk handles sessions seperately from codeigniter and makes use of the PHP superglobals, but from what the Codeigniter Documentation says the framework might unset those variables under certain conditions to make you access them via builtin codeigniter functions only.
My library uses the codeigniter sessions and cookies, it's written with using codeigniter provided functions if possible (for example for error handling I use codeigniter's functions to control wether to log or display an error based on level setting in config)
The other advantage is that it only exposes as little stuff publicly as needed.

If you don't need / want this, you're good to go with Danny Herrons workflow using the facebook provided sdk.

cdevroe commented May 16, 2011

@mastacheata It sounds nice, I don't see it on GitHub, do you have it somewhere else?


It's in my personal fork of elliot's codeigniter-facebook:

This is however not done yet. It works but I have not implemented the error handling completely. For now it just throws empty FacebookException.
I'll finish it up at some point this week, suggestions, error notifications or just comments are welcome.

anroots commented Jul 4, 2011

@golevel's pointer works indeed. Too bad elliot's is broken still...


All you really have to do is grab the original facebook php sdk and replace the native session with a codeigniter session...

sami-mw commented Jul 18, 2011

The problem AFAICT is that the token stored in the session (facebookSession) is not saved. So when the user is redirected to the function which called login or elsewhere, the library is reloaded and a new facebookSession object is created.
Does that make sense ? How is the session object supposed to work ?

SOLVED: The problem was that CI used an md5 check to verify the authenticity of the cookie and that was failing (I don't know why).
CI only uses that when cookie encryption is disabled so I enabled it by setting $config['sess_encrypt_cookie'] to TRUE in my config.php file.
Happy hacking


@millhacker it works for me! thanks a lot!
but had to click the login link twice, i don't know what's the problem again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.