I have seen a lot of questions here regarding the Facebook Graph API but I still haven't find a solution for simple 'login'/'logout' operations using it. Looks like the Single Sign-On style is causing more confusion than benefits.
I'd like to know if it is possible have the following situation:
- Enter in the app (no
accessToken
/expirationDate
created). - Perform a login using SSO by calling
authorize:delegate:
method (application goes background and the login is made in the 'global' scope (Facebook App/Mobile Safari), asking for the user credentials. - Enter back in the app (now logged in, both
accessToken
andexpirationDate
are saved toNSUserDefaults
). - Perform a logout by calling the
logout:
method (now logged out, bothaccessToken
andexpirationDate
are removed fromNSUserDefaults
) - Attempt to perform a login again, with exactly the same steps done in 2.
I realize that when I call logout:
, I do really log out from Facebook (accessToken
is invalidated) from my App scope, not from the global
scope (Facebook App/Mobile Safari). In 5.) when I try to log in again, the application goes to background and the login attempt is made again in Facebook App/Mobile Safari as usual, however I'm getting a screen saying that I'm already logged in:
You have already authorized
...
. Press "Okay" to continue. Logged in as...
(Not You?).
It's a strange behavior for the user that has just logged out in my App. My question is:
"Can I really log out from facebook (I mean 'global' scope) from inside my App? This would affect other apps using the facebook credentials too. However, if I can't to do this, how can I avoid the 'strange behavior' describe above?
Thanks
See Question&Answers more detail:os