title: Facebook. Fatal error: Uncaught OAuthException: An active access token must be used to query information about the current user
body: <p>with my app's administrator acount on facebook my app work normally, but with other account I get error: <code>Fatal error: Uncaught OAuthException: An active access token must be used to query information about the current user.</code>
  I had this problem before with other app (publish text on the user's wall), but fixed after i added
  <code>$user = $facebook-&gt;getUser();</code> What's wrong here? I have added <code>offline_access</code> permission... Help me, please if you can, Thank you very much.</p>
  
  <pre><code>&lt;?php
      require_once('images/Facebook.php');
  
        $facebook = new Facebook(array(
          'appId'  =&gt; '456080124457246',
          'secret' =&gt; 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
        ));
        $user_profile = $facebook-&gt;api('/me','GET');
      $accessToken = $facebook-&gt;getAccessToken();
  
        # Get User ID
        $user = $facebook-&gt;getUser();
        $facebook-&gt;setAccessToken($accessToken);
        $facebook-&gt;api(456080124457246);
  
  
       if ($user) {
          try {
  
        # Photo Caption
        $photoCaption = $user_profile['name'] . ' patarimų plaukams sužinojo čia http://goo.gl/otwhf';
  
        # Absolute Path to your image.
        $imageUrl = 'http://padekime.wu.lt/plaukai/images/PlaukaiNeuzvedus.jpg'; // Example URL
  
        # Post Data for Photos API
        $post_data = array(
            'message' =&gt; $photoCaption,
            'url' =&gt; $imageUrl
  
        );
  
            $apiResponse = $facebook-&gt;api('/me/photos', 'POST', $post_data);
  
        } catch (FacebookApiException $e) {
          error_log($e);
        }
      } else {
          $loginUrl = $facebook-&gt;getLoginUrl( array(
              'scope' =&gt; 'publish_stream,photo_upload'
          ));
          echo("&lt;script&gt;top.location.href = '" . $loginUrl . "';&lt;/script&gt;");
        }
      ?&gt;
  </code></pre>