开发者

Oauth Logout using facebook graph api

I just made a website where i'm authorizing the users using the oauth2.0 and graph api. I also want to logout the user from my website and facebook when they click on the logout button. I'm unable to f开发者_如何学运维ind a solution for this last 24 hours.My code is in asp.net. Thanks in Advance


If you're redirecting the user to a login page you should put the redirect within the callback function that can be passed to FB.logout as a parameter, like this:

<a href="#" onclick="mysignout(url);">logout</a>

function mysignout(url)

{
    FB.logout(function()
    {
        top.location.href = 'url'
    });
}

FB.logout appears to make an ajax call to revoke authentication on the server and can take several seconds to complete successfully. If you redirect within the anchor link then FB.logout will not have completed successfully before the redirect in some browsers. In particular, this will happen with IE.

See this post: FB.logout not working in IE8


<a href="#" onclick="FB.logout();">logout</a>
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜