Redirecting a page if user not logged in
<p>I'm building a web app that allows users to login with Facebook using OpenFB for Cordova.  I want only certain features viewable if they are logged in.  I am trying to run a check for login status and re-directing if not logged in.  This is what I have so far:</p>

<pre><code>&lt;head&gt;
  &lt;script&gt;
    if(openFB.getLoginStatus.loginStatus = 'unknown'){
                    window.location ="#/app/home";
    }
  &lt;/script&gt;
&lt;/head&gt;
</code></pre>

<p>The getLoginStats function is as such:</p>

<pre><code>function getLoginStatus(callback) {
    var token = tokenStore.fbAccessToken,
        loginStatus = {};
    if (token) {
        loginStatus.status = 'connected';
        loginStatus.authResponse = {accessToken: token};
    } else {
        loginStatus.status = 'unknown';
    }
    if (callback) callback(loginStatus);
}
</code></pre>

<p>When I console.log the value I am getting undefined. Even when logged in with facebook.  Am I missing something obvious?</p>

<p>Logout code requested:</p>

<pre><code>//logout function
$scope.fbLogout = function(){
 openFB.logout(); //logouts after revoking permissions.
 alert('Logged out');
}
</code></pre>