title: Why is Facebook OAuth Dialog using outdated permissions list for my app?
body: <p>I've removed 20+ permissions from Facebook for our app, yet for the life of me I cannot get Facebook OAuth Dialog requests to reflect the new reduced permissions list. It continues to ask for <em>more</em> permissions than I'm asking for, regardless of what I pass in.</p>
  
  <p>I've tried with my accounts that were previously linked on facebook with our app, and I've tried with brand new test accounts (created through the facebook developer site, without pre-authorizing them). I've tried uninstalling Facebook app and our app on my device, I've tried several different devices.</p>
  
  <p>I'm attempting to authorize the user using the Facebook Android SDK (pre-3.0), but I've also tried bypassing it and using our server-side auth flow, and it shows the old list in either case.</p>
  
  <p>I've searched our entire code base, client and server, for someplace permissions might be hiding, but they are nowhere. I've turned on debugging and print statements in the Facebook SDK, and can confirm it is in fact receiving my updated list of permissions to the .authorize() method, and it is attempting to load the mobile url in an FbDialog (when I uninstall the facebook app) using the correct permissions list. However, the permissions it displays include all the ones I've since removed.</p>
  
  <p>I've even tried adding the permissions to our previously blank list of permissions in the Facebook Developer site for the App Center listing, although I assume this has nothing to do with OAuth Dialog.</p>
  
  <p>This should also have nothing to do with the Facebook SDK 3.0+ method of doing only read permissions first, nor with the fact that Facecbook OAuth Dialog breaks up permissions into multiple pages. My problem is it requests <em>more</em> permissions than I want, not less.</p>
  
  <p>Specifically, it is requesting things like:</p>
  
  <p>notes, events, hometown, religious and political views, relationships, relationship interests, chat status, friends' relationships, relationship interests, notes, chat status, events, hometowns, religious and political views</p>
  
  <p>and yet I have removed all of those permissions. I have even tried requesting only the user_photos permission, but it continues to show a long list in the OAuth Dialog.</p>
  
  <p>Has anyone had this problem before? Is there some device cache that isn't removed when uninstalling facebook and your app?</p>
  
  <p>I know there used to be more settings in the Facebook App Developer site, for listing permissions for authenticated referrals and such, is it possible those settings have somehow remained behind the scenes, even though they're no longer accessible?</p>
  
  <p>Here is a complete log from the FbDialog class in Android Facebook SDK (pre-3.0), with me requesting only 'user_photos', and yet being shown the following dialog:</p>
  
  <pre><code>    D/Facebook-WebView( 5622): Webview loading URL: https://m.facebook.com/dialog/oauth?display=touch&amp;client_id=xxxx&amp;scope=user_photos&amp;type=user_agent&amp;redirect_uri=fbconnect%3A%2F%2Fsuccess
  D/Facebook-WebView( 5622): Redirect URL: http://m.facebook.com/login.php?skip_api_login=1&amp;api_key=xxxx&amp;signed_next=1&amp;next=https%3A%2F%2Fm.facebook.com%2Fdialog%2Foauth%3Fredirect_uri%3Dfbconnect%253A%252F%252Fsuccess%26display%3Dtouch%26scope%3Duser_photos%26type%3Duser_agent%26client_id%3Dxxxx%26ret%3Dlogin&amp;cancel_uri=fbconnect%3A%2F%2Fsuccess%3Ferror%3Daccess_denied%26error_code%3D200%26error_description%3DPermissions%2Berror%26error_reason%3Duser_denied&amp;display=touch&amp;_rdr
  D/Facebook-WebView( 5622): Webview loading URL: http://m.facebook.com/login.php?skip_api_login=1&amp;api_key=xxxx&amp;signed_next=1&amp;next=https%3A%2F%2Fm.facebook.com%2Fdialog%2Foauth%3Fredirect_uri%3Dfbconnect%253A%252F%252Fsuccess%26display%3Dtouch%26scope%3Duser_photos%26type%3Duser_agent%26client_id%3Dxxxx%26ret%3Dlogin&amp;cancel_uri=fbconnect%3A%2F%2Fsuccess%3Ferror%3Daccess_denied%26error_code%3D200%26error_description%3DPermissions%2Berror%26error_reason%3Duser_denied&amp;display=touch&amp;_rdr
  D/Facebook-WebView( 5622): Webview onPageFinished: http://m.facebook.com/login.php?skip_api_login=1&amp;api_key=xxxx&amp;signed_next=1&amp;next=https%3A%2F%2Fm.facebook.com%2Fdialog%2Foauth%3Fredirect_uri%3Dfbconnect%253A%252F%252Fsuccess%26display%3Dtouch%26scope%3Duser_photos%26type%3Duser_agent%26client_id%3Dxxxx%26ret%3Dlogin&amp;cancel_uri=fbconnect%3A%2F%2Fsuccess%3Ferror%3Daccess_denied%26error_code%3D200%26error_description%3DPermissions%2Berror%26error_reason%3Duser_denied&amp;display=touch&amp;_rdr
  D/Facebook-WebView( 5622): Webview loading URL: http://m.facebook.com/login.php?skip_api_login=1&amp;api_key=xxxx&amp;signed_next=1&amp;next=https%3A%2F%2Fm.facebook.com%2Fdialog%2Foauth%3Fredirect_uri%3Dfbconnect%253A%252F%252Fsuccess%26display%3Dtouch%26scope%3Duser_photos%26type%3Duser_agent%26client_id%3Dxxxx%26ret%3Dlogin&amp;cancel_uri=fbconnect%3A%2F%2Fsuccess%3Ferror%3Daccess_denied%26error_code%3D200%26error_description%3DPermissions%2Berror%26error_reason%3Duser_denied&amp;display=touch&amp;_rdr
  D/Facebook-WebView( 5622): Webview onPageFinished: http://m.facebook.com/login.php?skip_api_login=1&amp;api_key=xxxx&amp;signed_next=1&amp;next=https%3A%2F%2Fm.facebook.com%2Fdialog%2Foauth%3Fredirect_uri%3Dfbconnect%253A%252F%252Fsuccess%26display%3Dtouch%26scope%3Duser_photos%26type%3Duser_agent%26client_id%3Dxxxx%26ret%3Dlogin&amp;cancel_uri=fbconnect%3A%2F%2Fsuccess%3Ferror%3Daccess_denied%26error_code%3D200%26error_description%3DPermissions%2Berror%26error_reason%3Duser_denied&amp;display=touch&amp;_rdr
  D/Facebook-WebView( 5622): Webview loading URL: https://m.facebook.com/login.php?skip_api_login=1&amp;signed_next=1&amp;next=https%3A%2F%2Fm.facebook.com%2Fdialog%2Foauth%3Fredirect_uri%3Dfbconnect%253A%252F%252Fsuccess%26display%3Dtouch%26scope%3Duser_photos%26type%3Duser_agent%26client_id%3Dxxxx%26ret%3Dlogin&amp;refsrc=http%3A%2F%2Fm.facebook.com%2Flogin.php&amp;app_id=42701128600&amp;refid=9
  D/Facebook-WebView( 5622): Redirect URL: https://m.facebook.com/dialog/oauth?redirect_uri=fbconnect%3A%2F%2Fsuccess&amp;display=touch&amp;scope=user_photos&amp;type=user_agent&amp;client_id=xxxx&amp;ret=login&amp;ext=1372379560&amp;hash=AeZmYhdN1rISiaNZ&amp;refid=9&amp;_rdr
  D/Facebook-WebView( 5622): Webview loading URL: https://m.facebook.com/dialog/oauth?redirect_uri=fbconnect%3A%2F%2Fsuccess&amp;display=touch&amp;scope=user_photos&amp;type=user_agent&amp;client_id=xxxx&amp;ret=login&amp;ext=1372379560&amp;hash=AeZmYhdN1rISiaNZ&amp;refid=9&amp;_rdr
  D/Facebook-WebView( 5622): Webview onPageFinished: https://m.facebook.com/dialog/oauth?redirect_uri=fbconnect%3A%2F%2Fsuccess&amp;display=touch&amp;scope=user_photos&amp;type=user_agent&amp;client_id=xxxx&amp;ret=login&amp;ext=1372379560&amp;hash=AeZmYhdN1rISiaNZ&amp;refid=9&amp;_rdr
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/Ugfxw.jpg" alt="permissions dialog"></p>
  
  <p><strong>Update (Added code):</strong></p>
  
  <p>Below I list our full permission set, but in the log example above I commented all out except "user_photos".
  The parts that request Facebook authorize are essentially:</p>
  
  <pre><code>public final class MyFacebook {
  private static MyFacebook mInstance = null;
  private static Facebook mFBInstance = null;
  private String[] mPermissions = null;
  private Handler mHandler = null;
  
  public static MyFacebook getInstance() {
      if(mInstance == null) {
          mInstance = new MyFacebook();
      }
  
      return mInstance;
  }
  
  public Facebook getFBInstance() {
      if(mFBInstance == null) {
          mFBInstance = new Facebook("&lt;my facebook app id&gt;");
  
          SessionStore.restore(mFBInstance, MyApplication.getContext());
          SessionEvents.addAuthListener(new FacebookAuthListener());
          SessionEvents.addLogoutListener(new FacebookLogoutListener());
      }
  
      return mFBInstance;
  }
  
  private MyFacebook () {
      mHandler = new Handler();
  }
  
  public String[] getPermissionsList() {
      if(mPermissions == null) {
          int i = 0;
          mPermissions = new String[42];
          mPermissions[i++] = "user_about_me";
          mPermissions[i++] = "user_activities";
          mPermissions[i++] = "user_birthday";
          mPermissions[i++] = "user_education_history";
          mPermissions[i++] = "user_groups";
          mPermissions[i++] = "user_interests";
          mPermissions[i++] = "user_likes";
          mPermissions[i++] = "user_location";
          mPermissions[i++] = "user_photos";
          mPermissions[i++] = "user_status";
          mPermissions[i++] = "user_videos";
          mPermissions[i++] = "user_website";
          mPermissions[i++] = "user_work_history";
          mPermissions[i++] = "email";
          mPermissions[i++] = "read_friendlists";
          mPermissions[i++] = "read_mailbox";
          mPermissions[i++] = "read_requests";
          mPermissions[i++] = "read_stream";
          mPermissions[i++] = "user_checkins";
          mPermissions[i++] = "friends_about_me";
          mPermissions[i++] = "friends_activities";
          mPermissions[i++] = "friends_birthday";
          mPermissions[i++] = "friends_education_history";
          mPermissions[i++] = "friends_groups";
          mPermissions[i++] = "friends_interests";
          mPermissions[i++] = "friends_likes";
          mPermissions[i++] = "friends_location";
          mPermissions[i++] = "friends_photos";
          mPermissions[i++] = "friends_status";
          mPermissions[i++] = "friends_videos";
          mPermissions[i++] = "friends_website";
          mPermissions[i++] = "friends_work_history";
          mPermissions[i++] = "friends_checkins";
          mPermissions[i++] = "publish_stream";
          mPermissions[i++] = "manage_notifications";
          mPermissions[i++] = "publish_actions";
          mPermissions[i++] = "user_actions.music";
          mPermissions[i++] = "user_actions.news";
          mPermissions[i++] = "user_actions.video";
          mPermissions[i++] = "friends_actions.music";
          mPermissions[i++] = "friends_actions.news";
          mPermissions[i++] = "friends_actions.video";
      }
  
      return mPermissions;
  }
  
  public void logout() {
      SessionEvents.onLogoutBegin();
      AsyncFacebookRunner asyncRunner = new AsyncFacebookRunner(getInstance().getFBInstance());
      asyncRunner.logout(MyApplication.getContext(), new LogoutRequestListener());
  }
  
  
  public static class FacebookAuthListener implements AuthListener {
      public void onAuthSucceed() {
          Log.d("FB", "onAuthSucceed: ");
          SessionStore.save(getInstance().getFBInstance(), MyApplication.getContext());
          Log.d("FB", "Finished Saving in onAuthSucceed");
      }
  
      public void onAuthFail(String error) {
          Log.e("FB", error);
      }
  }
  
  public static class FacebookLogoutListener implements LogoutListener {
      public void onLogoutBegin() {
      }
  
      public void onLogoutFinish() {
          // remove our stored session
          SessionStore.clear(MyApplication.getContext());
      }
  }
  
  private class LogoutRequestListener extends BaseRequestListener {
      public void onComplete(String response, final Object state) {
          // callback should be run in the original thread,
          // not the background thread
          mHandler.post(new Runnable() {
              public void run() {
                  SessionEvents.onLogoutFinish();
              }
          });
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>And the usage:</p>
  
  <pre><code>@JavascriptInterface
      public void clientAddAccount(final int network) {
          AccountManageActivity.this.runOnUiThread(new Runnable(){
              @Override
              public void run() {
                  MyFacebook.getInstance().getFBInstance().authorize(ThisActivity.this, MyFacebook.getInstance().getPermissionsList(),
                                    new FBLoginDialogListener());
              }
          });
      }
  </code></pre>
  
  <p>...</p>
  
  <pre><code>private final class FBLoginDialogListener implements DialogListener {
      public void onComplete(Bundle values) {
          Log.d("LB", "Login Success. onComplete");
          SessionEvents.onLoginSuccess();
  
          if(MyFacebook.getInstance().getFBInstance().isSessionValid()) {
              // do app stuff
          }
      }
  
      public void onFacebookError(FacebookError error) {
          Log.d("LB", "onFacebookError: " + error.getMessage());
          SessionEvents.onLoginError(error.getMessage());
  
          // do app stuff
      }
  
      public void onError(DialogError error) {
          Log.d("LB", "onError: " + error.getMessage());
          SessionEvents.onLoginError(error.getMessage());
  
          // do app stuff
      }
  
      public void onCancel() {
          Log.d("LB", "onCancel");
          SessionEvents.onLoginError("Action Canceled");
  
          // do app stuff
      }
  }
  </code></pre>