简体   繁体   中英

Javascript Facebook Login button doesn't change to logout after login

I'm creating a website and I'm using facebook as my authentication. I did this before and it worked back then. However it doesn't function now. I can login and logoff, the button will always stay on "login with facebook".

I added autologoutlink="true", but it still doesn't work. Code below:

<fb:login-button autologoutlink="true" perms="">Login with Facebook</fb:login-button>  

If it helps, this is the rest of my facebook code:

<script src="http://connect.facebook.net/en_US/all.js"></script>  
<script>  
    FB.init({appId:'XXXXXXXXXXX', cookie:true, 
            status:true, xfbml:true
    });   

    // log IN event
    FB.Event.subscribe('auth.login', function(response) {  
        alert("logged in");
        insertMyInfo(response);          
    });

    // log OUT event
    FB.Event.subscribe('auth.logout', function(response) {
        alert("logged off");   
    });                
</script>

try to get the "Login with Facebook" text out of this

       <fb:login-button autologoutlink="true" perms="">Login with Facebook</fb:login-button>

I mean it should look like this

   <fb:login-button autologoutlink="true" perms=""></fb:login-button>

The text will be automatically completed accordingly to the situation( Login or Logout). I don't know if you still need the answer since it's been a while since you asked the question but ...still, just in case :)

It looks like Facebook has removed the autologoutlink parameter from their button:

https://developers.facebook.com/docs/reference/plugins/login/

It still shows up in the dropdown search results, so it was there at one time. Looks like it was removed. You should try getting the latest version of the Login button code from that page and try again.

Please change scobe

scope="public_profile,email"

<fb:login-button scope="public_profile,email" onlogin="checkLoginState();" data-size="large" data-auto-logout-link="true"></fb:login-button>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM