title: Facebook login not working from non-home page
body: <p>I have a (currently very simple) website that is utilising Facebook's "Website with Facebook Login" app setting. My problem seems simple on the face of it, but I'm unable to work it out, could someone shed any light?</p>
  
  <p>My website homepage is (say) <a href="https://www.mysite.net/" rel="nofollow">https://www.mysite.net/</a>
   - when I log in from here using the code below, it works. </p>
  
  <pre><code>if(!$this-&gt;facebook-&gt;getUser())
      {
          //NOT LOGGED IN 
         $params = array(
            'scope' =&gt; 'email, publish_stream, user_photos, status_update',
            'redirect_uri' =&gt; current_url(),
          );  
          $auth_url = $this-&gt;facebook-&gt;getLoginUrl($params);  
          $auth_text = "Log In";
      } 
      else 
      {
          //LOGGED IN         
          $fbid = $this-&gt;facebook-&gt;getUser();
          $fbid = $fbid;
          $auth_url = "https://www.facebook.com/logout.php?confirm=1&amp;next=".urlencode(base_url().'logout/')."&amp;access_token=".$this-&gt;facebook-&gt;getAccessToken();
          $auth_text = "Log Out";
      }
  
  &lt;a href="&lt;?=$auth_url;?&gt;" class="btn btn-primary"&gt;&lt;i class="icon-user"&gt;&lt;/i&gt; &lt;?=$auth_text;?&gt;&lt;/a&gt;
  </code></pre>
  
  <p>.. that works fine.</p>
  
  <p>However, when I use the same code (and the user needs to log in) from say <a href="https://www.mysite.net/second_page/" rel="nofollow">https://www.mysite.net/second_page/</a>, and I use the exact above code on the second page also, the login script redirects to the Facebook Auth Dialog (great), and redirects to the redirect_uri(also great), but the user is NOT logged in to the page - ie, it gives the "Log In" dialog rather than the expected "Log Out" dialog.</p>
  
  <p>Am I doing something wrong here? I would expect the facebook login dialog to work from any page off my app-specified site root. I don't want to need to redirect my users to the home page for every login, they need to be able to log in from any page of the site.</p>
  
  <p>Thoughts?</p>
  
  <p>Regards,
  Paul G</p>