title: The user hasn't authorized the application to perform this action android facebook SDK (#200)
body: <p>I am posting on my wall in facebook sdk 3.6 android but I am getting error:</p>
  
  <p>{HttpStatus: 403, errorCode: 200, errorType: OAuthException, errorMessage: (#200) The user hasn't authorized the application to perform this action}</p>
  
  <p>I tried all the ways what i found here. But still i am getting same error.</p>
  
  <pre><code>public class FacebookHelper implements OnFacebookPostClickListener {
  
  private static final String KEY_MESSAGE = "message";
  private static final String KEY_LINK = "link";
  private static final String KEY_MY_WALL = "me/feed";
  private Activity mActivity;
  private Resources mResources;
  private String mMessage;
  private String mShareLink;
  private WWFFacebookDialog mFacebookDialog;
  private String mPortraitKey;
  
  /**
   *  Class to provide asynchronous notification of Session state changes.
   * 
   */
  private Session.StatusCallback mStatusCallback = new Session.StatusCallback() {
  
      @Override
      public void call(Session session, SessionState state, Exception exception) {
          if (session.isOpened() || FacebookSessionHelper.hasPublishPermission()) {
              checkSessionState(session, state, exception);
          } else if (session.isOpened()) {
                              OpenRequest open = new OpenRequest(mActivity).setCallback(this);
              List&lt;String&gt; permission = new ArrayList&lt;String&gt;();
              permission.add(FacebookSessionHelper.PUBLISH_ACTION_PERMISSION);
              open.setPermissions(permission);
              session.openForPublish(open);
  
          }
      }
  };
  
  public FacebookHelper(Activity activity) {
      mActivity = activity;
      mResources = mActivity.getResources();
  }
  
  /**
   * Method to set result after Facebook login.
   * 
   * @param requestCode The integer request code originally supplied to startActivityForResult(), allowing you to identify who this result came from.
   * @param resultCode The integer result code returned by the child activity through its setResult().
   * @param data An Intent, which can return result data to the caller (various data can be attached to Intent "extras").
   */
  public void setFacebookLoginResult(int requestCode, int resultCode, Intent data) {
      FacebookSessionHelper.saveOnActivityResult(mActivity, requestCode, resultCode, data);
  }
  
  /**
   * Method to share with Facebook.
   * 
   * @param message Message to share.
   * @param shareLink Link to share.
   */
  public void shareWithFacebook(String message, String shareLink, String portraitKey) {
      mMessage = message;
      mShareLink = shareLink;
      mPortraitKey = portraitKey;
      if (FacebookSessionHelper.isOpened() || FacebookSessionHelper.hasPublishPermission()) {
          showFacebookAlert();
      } else {
          loginToFacebook();
      }
  }
  
  /**
   * Method to login to Facebook.
   */
  private void loginToFacebook() {
      Session session = FacebookSessionHelper.getActiveSession(mActivity);
  
      if (!session.isOpened() &amp;&amp; !session.isClosed()) {
          session.openForRead(new Session.OpenRequest(mActivity).setCallback(mStatusCallback));
      } else {
          Session.openActiveSession(mActivity, true, mStatusCallback);
      }
  }
  
  /**
   * Method to check Facebook session state.
   * 
   * @param session Facebook session.
   * @param state the state of a Session.
   * @param exception  
   */
  private void checkSessionState(Session session, SessionState state, Exception exception) {
      if (exception instanceof FacebookOperationCanceledException ||
              exception instanceof FacebookAuthorizationException) {
          AppUtils.showAlert(mActivity, mResources.getString(R.string.cancelled), 
                  mResources.getString(R.string.permission_not_granted));
      } else if (state == SessionState.OPENED_TOKEN_UPDATED) {
          AppUtils.showAlert(mActivity, mResources.getString(R.string.cancelled), 
                  mResources.getString(R.string.session_busy));
      } else {
          showFacebookAlert();
      }
  }
  
  /**
   * Method to show alert to display the user message to post.
   */
  private void showFacebookAlert() { 
      mFacebookDialog = new WWFFacebookDialog(mActivity, mMessage, this);
      mFacebookDialog.show();
  }
  
  /**
   * Method to post to Facebok wall.
   */
  private void postToFacebookWall(String message) {
      Bundle postParams = new Bundle();
      postParams.putString(KEY_MESSAGE, message);
      postParams.putString(KEY_LINK, mShareLink);
      Request.Callback callback= new Request.Callback() {
          public void onCompleted(Response response) {
              FacebookRequestError error = response.getError();
              if (error != null) {
                  Log.d("TAG", "&gt;&gt;&gt;&gt;Error: " + error.toString());
  
                  AppUtils.showToastMessage(mActivity, error.getErrorMessage());
              } else {
                  AppUtils.showToastMessage(mActivity, mResources.getString(R.string.posted_successfully));
                  AppUtils.setSharedOrigami(mActivity, mPortraitKey);
              }
  
              mFacebookDialog.dismiss();
          }
      };
  
      Request request = new Request(FacebookSessionHelper.getActiveSession(mActivity), 
              KEY_MY_WALL, postParams, HttpMethod.POST, callback);
  
      RequestAsyncTask task = new RequestAsyncTask(request);
      task.execute();
  }
  
  @Override
  public void onFacebookPostClick(String message) {
      postToFacebookWall(message);
  }
  </code></pre>
  
  <p>}</p>
  
  <pre><code>public class FacebookSessionHelper {
  
  private static Session mSession;
  public static final String PUBLISH_ACTION_PERMISSION = "publish_actions";
  public static final String LIKE_PERMISSION = "user_likes";
  
  
  /**
   * Returns the session if active, else returns null
   * @param context - in which context to be used
   * @return active session
   */
  public static Session getActiveSession(Context context) {
      mSession = Session.getActiveSession();
      if (mSession == null) {
          mSession = new Session(context);
          Session.setActiveSession(mSession);
      }
  
      return mSession;
  }
  
  /**
   * Restores the session from bundle if app is destroyed
   *  if its running in background to recover the memory
   * @param context - in which context to be used
   * @para cachingStrategy the TokenCachingStrategy to use to load and store the token. If this is null, a default 
   token cachingStrategy that stores data in SharedPreferences will be used
   * @param statusCallback - status call back of session to be called 
   * upon open, closed states.
   * @param savedInstanceState - bundle info of activity
   */
  public static void restoreSessionFromBundle(Activity context, TokenCachingStrategy cachingStrategy, StatusCallback statusCallback, Bundle savedInstanceState ) {
      mSession = Session.restoreSession(context, cachingStrategy, statusCallback , savedInstanceState);
  }
  
  /**
   * Opens the session in read mode which is not yet open, but has cached token
   * @param context - in which context to be used
   * @param statusCallback - - status call back of session to be called 
   * upon open, closed states.
   */
  public static void openSession(Activity context, StatusCallback statusCallback) {
      if ((mSession != null) &amp;&amp; (mSession.getState().equals(SessionState.CREATED_TOKEN_LOADED))) {
          mSession.openForRead(new Session.OpenRequest(context).setCallback(statusCallback));
      }
  }
  
  /**
   * Adds the callback to the session
   * @param statusCallback - status call back of session to be called 
   * upon open, closed states.
   */
  public static void addCallback(StatusCallback statusCallback) {
      if (mSession != null) {
          mSession.addCallback(statusCallback);
      }
  }
  
  /**
   * Removes the callback from session
   * @param statusCallback - status call back of session to be called 
   * upon open, closed states.
   */
  public static void removeCallback(StatusCallback statusCallback) {
      if (mSession != null) {
          mSession.removeCallback(statusCallback);
      }
  }
  
  /**
   * Save the session into bundle for recovering data when app runs in low memory 
   * @param outState - bundle info
   */
  public static void saveSessionIntoBundle(Bundle outState) {
      if (mSession != null) {
          Session.saveSession(mSession, outState);
      }
  }
  
  /**
   * Save activity result into session.
   * 
   * @param activity activity context.
   * @param requestCode The integer request code originally supplied to startActivityForResult(), allowing you to identify who this result came from.
   * @param resultCode The integer result code returned by the child activity through its setResult().
   * @param data An Intent, which can return result data to the caller (various data can be attached to Intent "extras").
   */
  public static void saveOnActivityResult(Activity activity, int requestCode, int resultCode, Intent data) {
      if (mSession != null) {
          mSession.onActivityResult(activity, requestCode, resultCode, data);
      }
  }
  
  /**
   * Says whether session is opened or not
   * @return true if session is opened, else false
   */
  public static boolean isOpened() {
      boolean isOpened = false;
      if (mSession != null) {
          isOpened = mSession.isOpened();
      }
  
      return isOpened;
  }
  
  /**
   * Says whether current session has publish permission
   * @return true if it has publish permission, else false
   */
  public static boolean hasPublishPermission() {
  
      return ((mSession != null) &amp;&amp;
              (mSession.getPermissions().contains(PUBLISH_ACTION_PERMISSION)));
  }
  
  /**
   * Says whether current session has publish permission
   * @return true if it has publish permission, else false
   */
  public static boolean hasLikePermission() {
  
      return ((mSession != null) &amp;&amp; 
              (mSession.getPermissions().contains(LIKE_PERMISSION)) &amp;&amp;
              hasPublishPermission());
  }
  
  /**
   * Requests for new publish permission
   * @param context - in which activity permission to be granted
   */
  public static void requestNewPublishPermission(Activity context) {
      if (mSession != null) {
          mSession.requestNewPublishPermissions(new Session.NewPermissionsRequest(context, PUBLISH_ACTION_PERMISSION, LIKE_PERMISSION));
      }
  }
  
  /**
   * Close the session and clear the token cache, nullifies the session object
   */
  public static void closeSession() {
      if (mSession != null) {
          mSession.closeAndClearTokenInformation();
          mSession = null;
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>status_update</p>