ShareKit/ShareKit — pull request #876 by tkach (2014-03-04 13:30:10+00:00)
Title: SHKFacebook. Login flow: Fixed authenticatoin bug in ios 6-7 — sharerAuthDidFinish was called sometimes with FBSession that has invalid access token (in the case of token expiration)

Hello!
https://developers.facebook.com/docs/facebook-login/testing-your-login-flow/
I had read this article in facebook documentation and figured out that some cases are not covered in SHKFacebook login logic. For example if user has disabled Facebook application via app settings.

In this case during authentication in iOS 6.0+ FBSession gets invalid accessToken
(app is removed from facebook app settings and is not authorized now).
So when Sharekit calls [FBSession openActiveSessionWithReadPermissions:...], the iOS 6+ device may think the old token is valid and will let the state go to Open, and success gets called. But it is already expired actually.

Then authentication error will only occure after calling next Facebook request call.
So for being sure that access token is surely valid, I test Facebook request with opened session and check response.
If access token validation error occured - we are trying to reopen session again.

I was stuck with a problem of login to facebook for 2 days and solution is finally found (I hope:))

Thanks for any comments