Once the User's Facebook Access Token is Invalidated for any reason (either deleting the app from the Facebook website or deleting the app's access from the Facebook settings), I Can't manage to Get a NEW TOKEN, no matter what I Do!
So Far, I've tried two methods: (sharedFaceBookManager is a Singleton that Manages Facebook)
1) [sharedFaceBookManager.facebook extendAccessToken]
;
This Works for the First time the "Invalidation" happens, the App will open FB's App and Prompt the User for whatever is Required and return to the App Safe and sound... The SECOND time the Access token is Invalid, extendAccessToken will just Hang there and the user will no longer be able to login through Facebook. Not a good Solution
.
2) Attempting to Delete Cookies, Disconnect form Facebook, and Re-Connect!
for(NSHTTPCookie *cookie in [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookies]) {
if([[cookie domain] isEqualToString:@"facebook"]) {
[[NSHTTPCookieStorage sharedHTTPCookieStorage] deleteCookie:cookie];
}
}
// Reconnecting:
NSArray *permissions = [NSArray arrayWithObjects:@"email", @"read_friendlists", @"user_photos", @"user_events", nil];
[FBSession openActiveSessionWithReadPermissions:permissions
allowLoginUI:YES
completionHandler:
^(FBSession *session,
FBSessionState state, NSError *error) {
[[EWFacebookManager sharedFaceBookManager] sessionStateChanged:session state:state error:error];
}];
This Only returns a Call to - (void)sessionStateChanged: with:FBSessionStateOpen
and the Apps Deals with this as if Login Succeeded, Result: ENDLESS LOOP (Login Success - Login Failed) NOT A GOOD SOLUTION!
I Know I Shouldn't call extendAccessToken when the Token is invalid, I Should Prompt the User to Login Again
ANYBODY? Please? We've even turned to an outsourcing company to help us deal with this and NO BREAK THROUGH!