title: Facebook iOS SDK 3.2, problems when user removed app from facebook.com
body: <p>I am using the Facebook iOS SDK (version 3.2), and everything works fine, until a user goes into Facebook and removes the app from the authorizes apps list. At that point, I am still logged in with the cached session, even though it's not actually valid anymore. Forcing a clear of the access token and logging in again also results in the same old access token being used.</p>
  
  <p>Right now in <code>application:didFinishLaunchingWithOptions:</code> I have this code to test the session:</p>
  
  <pre><code>// Relogin with cached session
  if (FBSession.activeSession.state == FBSessionStateCreatedTokenLoaded) {
      NSLog(@"We're logged in to Facebook!");
  
      [FBSession openActiveSessionWithReadPermissions:nil allowLoginUI:NO completionHandler:^(FBSession *session, FBSessionState status, NSError *error) {
          NSLog(@"accessToken: %@", session.accessTokenData.accessToken);
          NSLog(@"status: %i", status);
          NSLog(@"error: %@", error);
  
          switch (status) {
              case FBSessionStateOpen:
                  NSLog(@"FBSessionStateOpen");
                  NSLog(@"permissions: %@", session.permissions);
                  break;
  
              case FBSessionStateClosed:
              case FBSessionStateClosedLoginFailed:
                  [session closeAndClearTokenInformation];
                  [Utilities presentMessage:@"Facebook login failed" withTitle:@"Error" level:MessageLevelError];
                  break;
  
              default:
                  break;
          }
      }];
  }
  </code></pre>
  
  <p>Every time I start the app, it says I'm still logged in with the user_birthday and email permissions. However, when I try to open <a href="https://graph.facebook.com/me?access_token=xxx" rel="nofollow">https://graph.facebook.com/me?access_token=xxx</a> with the accessToken I got, it returns "Error validating access token: User 123 has not authorized application 123."</p>
  
  <p>Clearing the token with <code>[FBSession.activeSession closeAndClearTokenInformation];</code> and forcing a new login doesn't help, I always end up with the exact same old accessToken.</p>
  
  <p>There is a similar question (<a href="http://facebook.stackoverflow.com/questions/12850032/facebook-sdk-3-1-ios-handle-login-if-user-remove-app-from-facebook-settings">Facebook SDK 3.1 iOS: Handle login if user remove app from Facebook Settings</a>), but it states that "Then, the user closes the iOS app and relaunches it... With this relaunch, the iOS app "is fixed" and detects that the user is no longer logged in." I don't have this behavior at all.</p>
  
  <p>This is how I open the session in the first place:</p>
  
  <pre><code>- (void)openFBSession {
      NSArray *perm = @[ @"user_birthday", @"email" ];
  
      [FBSession openActiveSessionWithReadPermissions:perm allowLoginUI:YES completionHandler:^(FBSession *session, FBSessionState status, NSError *error) {
          DLog(@"accessToken: %@", session.accessTokenData.accessToken);
          DLog(@"status: %i", status);
          DLog(@"error: %@", error);
  
          switch (status) {
              case FBSessionStateOpen:
                  DLog(@"FBSessionStateOpen");
                  // this is where I need to use session.accessTokenData.accessToken, which is stale
                  break;
  
              case FBSessionStateClosed:
              case FBSessionStateClosedLoginFailed:
                  [FBSession.activeSession closeAndClearTokenInformation];
                  [Utilities presentMessage:@"Facebook login failed" withTitle:@"Error" level:MessageLevelError];
                  break;
  
              default:
                  break;
          }
      }];
  }
  </code></pre>