How to get Facebook Login Button To Display "Logout"

Posted by Will Merydith on Stack Overflow See other posts from Stack Overflow or by Will Merydith
Published on 2010-12-23T20:59:58Z Indexed on 2010/12/23 21:54 UTC
Read the original article Hit count: 279

I apologize ahead of time if this is clearly documented somewhere on the FB developer site - but I can't find it (so please link me if appropriate).

I've implemented the FB login button on a website using GAE + Python. Here is the HTML:

<fb:login-button></fb:login-button>
<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
  FB.init({appId: 'ad16a806fc10bef5d30881322e73be68', status: true, cookie: true, xfbml: true});
  FB.Event.subscribe('auth.sessionChange', function(response) {
    if (response.session) {
      // A user has logged in, and a new cookie has been saved
    } else {
      // The user has logged out, and the cookie has been cleared
    }
  });
</script>

Currently the behavior is - if I click on the "login" button, I am asked to allow the application access to FB. Which I then choose, "OK". But then the login button is still showing "login" and not "logout". How do I implement that? On the server or client side?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about python