Closed zakmandhro closed 13 years ago
Sadly, I don't really understand how or why the cookie is set. It apparently is supposed to follow the practices of the php library, but it sounds like that isn't happening.
I've asked the creators of that code to help look into this issue.
I have facebooker2 working successfully in this kind of scenario. The problem is that the access_token being passed into the cookie setting routine is empty, which causes the cookie to be set to deleted. This is desired behavior as far as I'm aware (see the code comments above the cookie setting routine). I think the thing to understand is why the access token is nil at some point in the request cycle which is causing the cookie value to be set to deleted.
Could you post up a sample project on github using the instructions above. I tried to recreate your issue using the above but couldn't - it seemed to work for me. Off the top of my head, it could be a few things, depending on browser, facebook app settings or maybe just a bug.
Here it is, the Rails 3 project to reproduce this: https://github.com/zakmandhro/facebooker2_cookie_bug
You'll need to add your own Facebook App keys to facebooker2.yml
. The Facebook-side app settings on mine were default. The only thing I added was Site URL under Web Site pointing to root
path.
Ok, I can replicate the problem. I've actually just prepared some fixes that were related to a bug I was seeing in safari which also seem to fix your problem.
The fixes are currently in : https://github.com/rjlee/facebooker2
Try adding this to the Gemfile :
gem 'facebooker2', :git => 'git://github.com/rjlee/facebooker2.git', :ref => '6fe4cbf'
Could you just check this fixes your issue, it seemed to work when I tried it with your sample app.
I'll be pushing these changes upstream tomorrow, all things being well.
Confirmed, your fork + ref listed above fixed the problem. Thanks! Please let me know when pushed upstream and I'll switch back.
0.9 released to fix this
In Rails 3, if a controller does redirect_to, the
Facebooker2::Rails::Controller#set_fb_cookie
setsfbs_[APP_ID]
cookie todeleted
. To reproduce:ApplicationController
include#{current_user}
redirect_to
to the view that renders current_userI commented out the line that sets the cookie to 'deleted' and everything seems to work fine - including login, logout, redirect and refresh.
What am I missing?