mmangino / facebooker2

A simple facebook connect library for ruby
MIT License
311 stars 93 forks source link

how to find out if user has logged out of FB? #64

Closed papayaah closed 12 years ago

papayaah commented 12 years ago

i need to log the user out of my app when that person logs out of his facebook account, i don't seem to find a way to discover this?

I tried to use current_facebook_user but it is never set to nil. I tried to use current_facebook_user.fetch and it seems to throw an exception if the user logs out - but its erratic. Does not behave like that all the time for all users.

what is the correct way to discover if the user is still logged in facebook or not?

mmangino commented 12 years ago

The javascript API will update the cookies. If you aren't using the javascript api, you just need to handle the exceptions.

Mike

On Oct 25, 2011, at 10:42 AM, David Ang wrote:

i need to log the user out of my app when that person logs out of his facebook account, i don't seem to find a way to discover this?

I tried to use current_facebook_user but it is never set to nil. I tried to use current_facebook_user.fetch and it seems to throw an exception if the user logs out - but its erratic. Does not behave like that all the time for all users.

what is the correct way to discover if the user is still logged in facebook or not?

Reply to this email directly or view it on GitHub: https://github.com/mmangino/facebooker2/issues/64

Mike Mangino http://www.elevatedrails.com

papayaah commented 12 years ago

Hi Mike

Thanks for the fast response. I am using the javascript api - i had your helper on my page: fb_connect_async_js. See code - http://d.pr/vw3c

Am I suppose to be adding something else? Should i use be using FB.getLoginStatus to check for login? (its always false when i tried).

My code is really minimal - using your helper fb_connect_async_js and fb_login_and_redirect on my layout template.

On my application code, I simply use current_facebook_user and current_facebook_user.fetch to check if the user can login to FB or not. Its really erratic some of my peers logs out of Facebook and current_facebook_user.fetch still succeeds.

mmangino commented 12 years ago

Welcome to the world of Facebook. There is no really good way to test things. On the web side, a page reload is needed to detect logout, and it may actually take two pages. I typically just ignore logging out and handle the exceptions from Facebook globally.

Mike

On Oct 25, 2011, at 12:18 PM, David Ang wrote:

Hi Mike

Thanks for the fast response. I am using the javascript api - i had your helper on my page: fb_connect_async_js. See code - http://d.pr/vw3c

Am I suppose to be adding something else? Should i use be using FB.getLoginStatus to check for login? (its always false when i tried).

My code is really minimal - using your helper fb_connect_async_js and fb_login_and_redirect. On my application code, I simply use current_facebook_user and current_facebook_user.fetch to check if the user can login to FB or not. Its really erratic some of my peers logs out of Facebook and current_facebook_user.fetch still succeeds.

Reply to this email directly or view it on GitHub: https://github.com/mmangino/facebooker2/issues/64#issuecomment-2519253

Mike Mangino http://www.elevatedrails.com

papayaah commented 12 years ago

Oh - so this kind of behavior is normal and is expected? So then its good to know im using your library correctly and nothing is wrong on my end.

Thanks for the advise Mike.

On Oct 26, 2011, at 12:21 AM, Mike Mangino wrote:

Welcome to the world of Facebook. There is no really good way to test things. On the web side, a page reload is needed to detect logout, and it may actually take two pages. I typically just ignore logging out and handle the exceptions from Facebook globally.

Mike

On Oct 25, 2011, at 12:18 PM, David Ang wrote:

Hi Mike

Thanks for the fast response. I am using the javascript api - i had your helper on my page: fb_connect_async_js. See code - http://d.pr/vw3c

Am I suppose to be adding something else? Should i use be using FB.getLoginStatus to check for login? (its always false when i tried).

My code is really minimal - using your helper fb_connect_async_js and fb_login_and_redirect. On my application code, I simply use current_facebook_user and current_facebook_user.fetch to check if the user can login to FB or not. Its really erratic some of my peers logs out of Facebook and current_facebook_user.fetch still succeeds.

Reply to this email directly or view it on GitHub: https://github.com/mmangino/facebooker2/issues/64#issuecomment-2519253

Mike Mangino http://www.elevatedrails.com

Reply to this email directly or view it on GitHub: https://github.com/mmangino/facebooker2/issues/64#issuecomment-2519286

mmangino commented 12 years ago

Yeah, Facebook kind of hacked authentication together. There is no good way to coordinate logout, so they just do it halfway. It's one of many reasons I try to do as little with Facebook as possible.

Mike

On Oct 25, 2011, at 12:37 PM, David Ang wrote:

Oh - so this kind of behavior is normal and is expected? So then its good to know im using your library correctly and nothing is wrong on my end.

Thanks for the advise Mike.

On Oct 26, 2011, at 12:21 AM, Mike Mangino wrote:

Welcome to the world of Facebook. There is no really good way to test things. On the web side, a page reload is needed to detect logout, and it may actually take two pages. I typically just ignore logging out and handle the exceptions from Facebook globally.

Mike

On Oct 25, 2011, at 12:18 PM, David Ang wrote:

Hi Mike

Thanks for the fast response. I am using the javascript api - i had your helper on my page: fb_connect_async_js. See code - http://d.pr/vw3c

Am I suppose to be adding something else? Should i use be using FB.getLoginStatus to check for login? (its always false when i tried).

My code is really minimal - using your helper fb_connect_async_js and fb_login_and_redirect. On my application code, I simply use current_facebook_user and current_facebook_user.fetch to check if the user can login to FB or not. Its really erratic some of my peers logs out of Facebook and current_facebook_user.fetch still succeeds.

Reply to this email directly or view it on GitHub: https://github.com/mmangino/facebooker2/issues/64#issuecomment-2519253

Mike Mangino http://www.elevatedrails.com

Reply to this email directly or view it on GitHub: https://github.com/mmangino/facebooker2/issues/64#issuecomment-2519286

Reply to this email directly or view it on GitHub: https://github.com/mmangino/facebooker2/issues/64#issuecomment-2519507

Mike Mangino http://www.elevatedrails.com

papayaah commented 12 years ago

Unfortunately for us our game relies solely on Facebook. All our players are facebook users!

On Oct 26, 2011, at 12:41 AM, Mike Mangino wrote:

Yeah, Facebook kind of hacked authentication together. There is no good way to coordinate logout, so they just do it halfway. It's one of many reasons I try to do as little with Facebook as possible.

Mike

On Oct 25, 2011, at 12:37 PM, David Ang wrote:

Oh - so this kind of behavior is normal and is expected? So then its good to know im using your library correctly and nothing is wrong on my end.

Thanks for the advise Mike.

On Oct 26, 2011, at 12:21 AM, Mike Mangino wrote:

Welcome to the world of Facebook. There is no really good way to test things. On the web side, a page reload is needed to detect logout, and it may actually take two pages. I typically just ignore logging out and handle the exceptions from Facebook globally.

Mike

On Oct 25, 2011, at 12:18 PM, David Ang wrote:

Hi Mike

Thanks for the fast response. I am using the javascript api - i had your helper on my page: fb_connect_async_js. See code - http://d.pr/vw3c

Am I suppose to be adding something else? Should i use be using FB.getLoginStatus to check for login? (its always false when i tried).

My code is really minimal - using your helper fb_connect_async_js and fb_login_and_redirect. On my application code, I simply use current_facebook_user and current_facebook_user.fetch to check if the user can login to FB or not. Its really erratic some of my peers logs out of Facebook and current_facebook_user.fetch still succeeds.

Reply to this email directly or view it on GitHub: https://github.com/mmangino/facebooker2/issues/64#issuecomment-2519253

Mike Mangino http://www.elevatedrails.com

Reply to this email directly or view it on GitHub: https://github.com/mmangino/facebooker2/issues/64#issuecomment-2519286

Reply to this email directly or view it on GitHub: https://github.com/mmangino/facebooker2/issues/64#issuecomment-2519507

Mike Mangino http://www.elevatedrails.com

Reply to this email directly or view it on GitHub: https://github.com/mmangino/facebooker2/issues/64#issuecomment-2519562

mmangino commented 12 years ago

You can ask Facebook for a method, but at this point, there's nothing we can do to make this work. It's a facebook limitation.