Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to logout facebook - using code in rails application (Ruby on Rails Omniauth)

I tried to add more than one twitter and facebook accounts from my page via omniauth in rails.

Twitter working fine using force_login parameter.

But, facebook not supporting this.

i can add only one facebook account using /auth/facebook. After i tried to add new facebook account using /auth/facebook path then it returns to my home page only.

If i browse www.facebook.com in same browser then the login page not appearing. The lastly added facebook account page is opening.

when i logout from facebook in browser then i tried /auth/facebook path. its working fine.

So, need to logout already opened facebook accounts in browser tabs, before i hit add facebook link in my page.

Can anyone help? thanks.

like image 219
suresh.g Avatar asked Sep 25 '12 05:09

suresh.g


2 Answers

by deafult, you cannot log in multiple facebook account within one browser unless you have a method to trigger browser(like private browsing-mozilla, incognito Window-chrome ) to let your user sign in. websites uses cookies to track their status.

however, facebook do provide auth_type=reauthenticate. which the doc is here. https://developers.facebook.com/docs/howtos/login/client-side-re-auth/

Any correct me if im wrong.

like image 172
Nich Avatar answered Sep 21 '22 17:09

Nich


watch this screencast it has the soultion

http://railscasts.com/episodes/360-facebook-authentication

like image 22
Aayush Khandelwal Avatar answered Sep 24 '22 17:09

Aayush Khandelwal