title: How to fix "(#200) The user hasn't authorized the application to perform this action" error while posting on facebook wal
body: <p>I am getting "(#200) The user hasn't authorized the application to perform this action" error when posting message on user's facebook wall. I am using facebook graph API. I have also set the "publish_actions" permission in the scope, but didn't working. My code is </p>
  
  <pre><code>require 'facebook/facebook.php';
  
  $facebook = new Facebook(array(
              'appId' =&gt; APP_ID,
              'secret' =&gt; APP_SECRET,
              ));
  
  $user = $facebook-&gt;getUser();
  
  if ($user) {
      $accessToken = $facebook-&gt;getAccessToken();
  
      try {
          //create message with token gained before
          $post =  array(
              'access_token' =&gt; $accessToken,
              'message' =&gt; 'Test message'
          );
  
          $res = $facebook-&gt;api('/me/feed', 'POST', $post);
  
      } catch (FacebookApiException $e) {
          error_log($e);
          $user = null;
      }
  } else {
      # There's no active session, let's generate one
      $login_url = $facebook-&gt;getLoginUrl(array(
          'scope' =&gt; 'publish_actions'
      ));
      header("Location: " . $login_url);
  }
  </code></pre>
  
  <p>Can you please suggest me what i am missing in the code or in the app?</p>