Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FB.logout() called without an access token error

I have upgraded my js FB Connect to oauth version & when I am trying to logout from FB programatically using FB.logout() method, I am getting error like

"FB.logout() called without an access token"

What is the problem behind this? I saw one thread over here but it didn't worked for me. Please help me if someone has found solution for this. Thanks.

like image 201
Fbk Dev Avatar asked Dec 19 '11 05:12

Fbk Dev


People also ask

What is the use of Facebook access token?

An access token is an opaque string that identifies a user, app, or Page and can be used by the app to make graph API calls. When someone connects with an app using Facebook Login and approves the request for permissions, the app obtains an access token that provides temporary, secure access to Facebook APIs.

Does Facebook login use OAuth?

OAuth is also used when giving third-party apps access to accounts like your Twitter, Facebook, Google, or Microsoft accounts. It allows these third-party apps access to parts of your account. However, they never get your account password.


1 Answers

This is what i've used before.

//check if logout is 
FB.getLoginStatus(function(ret) {
    /// are they currently logged into Facebook?
    if(ret.authResponse) {
        //they were authed so do the logout
        FB.logout(function(response) {
           //do your stuff here.
        });
    } else {
       ///do something if they aren't logged in
       //or just get rid of this if you don't need to do something if they weren't logged in
    }
});
like image 122
timbrown Avatar answered Sep 20 '22 11:09

timbrown