3 ms·
Yeah I've been trying to fix that. Facebook isn't making it easy... if anybody is familiar with the Facebook javascript SDK holler. 200 points :)
by jaekwon 16y ago
Yeah I've been trying to fix that. Facebook isn't making it easy... if anybody is familiar with the Facebook javascript SDK holler. 200 points :)
- NathanKP 16y agoI can help with that. Basically you just need to show the login button. It automatically turns into a logout button when the person is logged in. Or for a prettier solution you can use the following JavaScript attached to an onclick event handler on a custom logout button: FB.logout(); Edit: For reference I would recommend reading this page thoroughly because there are some other cool things you can do with the SDK: http://developers.facebook.com/docs/reference/javascript/ http://developers.facebook.com/docs/reference/javascript/
- jaekwon 16y agoThanks, I need some direction here. I'm testing it out on my dev, and the login button is not turning into a logout button even when I am logged in via facebook. Also, FB.logout(); is logging the user out of facebook, which probably isn't desirable. Is this only happening on my end?
- mileszs 16y agoEdit: Whoops. I didn't quite grasp what you were asking until I had already responded. I think that is the intended behavior behind FB.logout() (as opposed to only logging one out of your site and not out of Facebook). If you want to only log someone out of your site, you've probably got a session variable of some sort you want to destroy, right?
- NathanKP 16y agoYes, clearing the cookies on your domain will log users out of your site only. You can accomplish that with some simple JavaScript. Just check the cookies using your browser inspection tool to see which one is set by Facebook.