FB.getLoginStatus returns status unknown

fb.getloginstatus not working
sign in with facebook javascript
facebook login example
facebook feed api javascript example
fb-login called when user is already connected
facebook oauth
facebook javascript sdk
facebook login java web application

When calling FB.getLoginStatus using a valid Facebook App the response status is always unknown. Exact response is {authResponse: undefined, status: "unknown"}.

<html>
<body>
    <div id="fb-root"></div>

    <script>
    window.fbAsyncInit = function(){
        FB.init({ appId:'1484134468466778', status:true,  cookie:true, xfbml:true});
        FB.getLoginStatus(function(response){
        console.log(response);
        });
    };

    (function(d){
        var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
        js = d.createElement('script'); js.id = id; js.async = true;
        js.src = "//connect.facebook.net/en_US/all.js";
        d.getElementsByTagName('head')[0].appendChild(js);
    }(document));
    </script>
</body>
</html>

Example URL: http://media.tuentifotos.com/simple_test.html

Here a screenshot of the Facebook App Settings.


Login Status - Web SDKs - Documentation, Login Status. FB.getLoginStatus() allows you to determine if a user is logged in to unknown ) getLoginStatus will return data from this cached response. 1 If I am logged into facebook.com, I expect a call to FB.getLoginStatus will return a status='not_authorized'. Instead it returns status='unknown', even if I pass true for the 'force' parameter. If I call FB.login, and then call FB.getLoginStatus, I get status='connected'.


I too faced this problem in Chrome. However, in Firefox it worked as expected with the status returned as connected when the user had logged in previously.

I found a clue about this from an answer to the similar question here.

The root cause of this issue is, on FB.logout(), Chrome is not removing the cookie fblo_<your-app-id> which is somehow affecting FB.getLoginStatus() function to return unknown

Fix: On calling FB.logout(), you may programmatically delete the cookie fblo_<your-app-id>

FB.logout(function(response) {
  deleteCookie("fblo_" + fbAppId); // fblo_yourFBAppId. example: fblo_444499089231295
});

function deleteCookie(name) {
  document.cookie = name +'=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;';
}

Just getting started login status unknown, Full docs on the response object can be found in the documentation // for FB.​getLoginStatus(). if (response.status === 'connected') { // Logged into your app and  FB.getLoginStatus returns status unknown. 2. FB.getLoginStatus is not returning correct status when third party cookies are disabled in chrome. Hot Network Questions


For me this meant "on my login page" I needed to specify cookies.

  window.fbAsyncInit = function() {
   FB.init({
      version: 'v2.8',
      cookie     : true,
    });
  };

But don't ask me why this was the case. It also fixed it needing to click twice on the login button to actually login, and doesn't even require an appId, seemingly, FWIW...

handleStatusChange always returns "unknown status" before, Hey buddies! I'm developing a simple app for Android OS. Following the examples, when the user starts the app, the first code that I execute is: FB.init({ appId:  As stated in Facebook document, FB.getLoginStatus will return with three possible responses: The user is logged into Facebook and has authenticated your application (connected) The user is logged into Facebook but has not authenticated your application (not_authorized)


When I checked, the status is showing "not_authorized" and that's fine, since I've not authorized the app yet.

To complete the flow, you should add the FB.login whenever user id is not authorized or not logged-in to facebook:

window.fbAsyncInit = function(){
    FB.init({ appId:'{APP-ID}', status:true,  cookie:true, xfbml:true});
    FB.getLoginStatus(function(response){
        if (response.status === 'connected') {
           //proceed
        } else if (response.status === 'not_authorized') {
           login();
        } else {
          login();
        }
    });
};

function login(){
   FB.login(function(response) {
      if (response.authResponse) {
         // proceed
      } else {
         // not auth / cancelled the login!
      }
   });
}

FB.getLoginStatus returns status unknown, When calling FB.getLoginStatus using a valid Facebook App the response status is always unknown. Exact response is {authResponse: undefined, status: Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information. Learn more FB.getLoginStatus returning status unknown


Facebook Javascript SDK getLoginStatus Returning Unknown , Facebook Javascript SDK getLoginStatus Returning Unknown (completely inconsistently) - php. with getLoginStatus, but now it's returning status: unknown about 80% of the time. getLoginStatus will return data from this cached response. The root cause of this issue is, on FB.logout(), Chrome is not removing the cookie fblo_<your-app-id> which is somehow affecting FB.getLoginStatus() function to return unknown. Fix: On calling FB.logout(), you may programmatically delete the cookie fblo_<your-app-id>


Facebook Login · 2, When calling FB.getLoginStatus using a valid Facebook App the response status is always unknown. Exact response is {authResponse:  While you can call FB.getLoginStatus any time (for example, when the user tries to take a social action), most social apps need to know the user's status as soon as possible after the page loads. In this case, rather than calling FB.getLoginStatus explicitly, it is possible to check the user's status by setting status: true when you call FB.init.


getLoginStatus function - facebook_web_sdk library, Log In Status: unknown | Disconnect | Logout getLoginStatus() function in the SDK will return the current login status of the user, and this example will show  The first time in the current browser session that FB.getLoginStatus is called, or the JS SDK is init'd with status: true, the response object will be cached by the SDK. Subsequent calls to FB.getLoginStatus will return data from this cached response. cedverd commented on Feb 7, 2018 i m logged in but even though it returns null response


getLoginStatus allows you to determine if a user is logged in to Facebook and LoginStatus.unknown Knowing which of the these three states the user is in is  FB.getLoginStatus returns unknown status with no user information FB.login works Written in the console: The method FB.getLoginStatus can no longer be called from http pages.