elliothaughin / codeigniter-facebook

Facebook Graph API, OpenGraph, and Connect for CodeIgniter
322 stars 86 forks source link

Never says logged in. #12

Open digitalfiz opened 13 years ago

digitalfiz commented 13 years ago

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: http://dev.digital-focus.us/test/blah/facebook_test I will leave it up and wait for a response

santiph commented 13 years ago

I'm having the exactly same problem. (You can try it here: 173.230.130.114:8020/facebook_test) 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 13 years ago

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.

RyanPaiva56 commented 13 years ago

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.

ChrisTeso commented 13 years ago

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

RyanPaiva56 commented 13 years ago

Use this guide instead: http://www.dannyherran.com/2011/02/facebook-php-sdk-and-codeigniter-for-basic-user-authentication/

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

cdevroe commented 13 years ago

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

mastacheata commented 13 years ago

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 13 years ago

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

mastacheata commented 13 years ago

@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 13 years ago

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

mastacheata commented 13 years ago

It's in my personal fork of elliot's codeigniter-facebook: mastacheata/codeigniter-facebook@3a207734e6e56d48fd0e

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 13 years ago

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

rjsmithii commented 13 years ago

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 13 years ago

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

warrenca commented 13 years ago

@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.