开发者

Disabling auto login in facebook connect

开发者 https://www.devze.com 2023-03-30 11:53 出处:网络
I have used this code for registering on website using facebook connect <div id=\"fb-root\"></div>

I have used this code for registering on website using facebook connect

<div id="fb-root"></div>
<script type="text/javascript">
window.fbAsyncInit = function() {


    FB.init({appId: "<?=FB_APP_ID?>", status: true, cookie: true, xfbml: true});
    /* All the events registered */
    FB.Event.subscribe('auth.login', function(response) {
    // do something with response
    alert('Here');
    login();
    });
    FB.Event.subscribe('auth.logout', function(response) {
    // do something with response
    logout();
    });
};

(function() {

    var e = document.createElement('script');
    e.type = 'text/javascript';
    e.src = document.location.protocol +'//connect.facebook.net/en_US/all.js';
    e.async = true;
    document.getElementBy开发者_Go百科Id('fb-root').appendChild(e);
    }());
function login(){
    document.location.href = "<?=SITEPATH?>users/fb_login";
}
function logout(){
    document.location.href = "<?=SITEPATH?>users/logout";
}
</script>

<fb:login-button perms="user_hometown,email,user_birthday">Login with Facebook</fb:login-button>

This is working fine when the user is first login in to the site and and there is no face book session.If i have opened the facebook page and afer that i clicked on the fb button it is not going in to the fb_login page.Actually i want to disable auto login.Thanks in advance


Just call FB.logout() when you load your page and after you init the Facebook SDK. You're users might get a bit annoyed though as this will log them out of Facebook as well. The two logins are tied together so once you've "connected" your linked.

0

精彩评论

暂无评论...
验证码 换一张
取 消