Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Oauth Logout using facebook graph api

Tags:

graph

facebook

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 find a solution for this last 24 hours.My code is in asp.net. Thanks in Advance

like image 634
Sam Avatar asked May 30 '10 11:05

Sam


2 Answers

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

like image 154
Michael Phillips Avatar answered Nov 15 '22 08:11

Michael Phillips


<a href="#" onclick="FB.logout();">logout</a>
like image 38
Doron Ben-David Avatar answered Nov 15 '22 07:11

Doron Ben-David