Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check FB Connect session expire using facebooker

how to check whether FB Connect session is still valid or not using rails facebooker plugin ? Are there any helper or module that can check the session ? I figure out that if I open up 2 tab in browser, one login with facebook, another is with my site and login using FB Connect. When user trying to logout in my site, facebook will erase both cookie, but when user logout through facebook, it will erase cookie in facebook site only, so the cookie in my site still left behind and I need to check whether the cookie still valid or not...

like image 624
gkrdvl Avatar asked Dec 04 '25 17:12

gkrdvl


1 Answers

Using Facebooker, you'll get an exception when you try to use the exception, which can be rescue_from'd in application.rb

rescue_from Facebooker::Session::SessionExpired, :with => :facebook_session_expired

def facebook_session_expired
  clear_fb_cookies!
  clear_facebook_session_information
  reset_session # remove your cookies!
  flash[:error] = "Your facebook session has expired."
  redirect_to root_url
end
like image 97
Hugo Duncan Avatar answered Dec 07 '25 08:12

Hugo Duncan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!