facebook-ios-sdk注销问题 [英] facebook-ios-sdk logout question
问题描述
我在Facebook Graph API中看到很多问题,但是我仍然没有找到使用它的简单登录/注销操作的解决方案。看起来像单点登录风格会导致更多的困惑而不是好处。
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:
- 输入应用程序(无
accessToken
/expirationDate
创建)。 - 通过调用
authorize:delegate:
方法(应用程序进入后台登录,进行登录)在全球范围(Facebook App / Mobile Safari)中,请求用户凭据。 - 回到应用程序(现在登录,
accessToken
和expirationDate
保存到NSUserDefaults
)。 - 通过调用
logout:
方法(现在退出,accessToken
和从
)NSUserDefaults
中删除expirationDate - 尝试再次执行登录,相同的步骤在2中完成。
- 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.
确定当我调用注销:
,我从我的应用程序范围真的从Facebook注销( accessToken
无效) ,而不是从全局
范围(Facebook App / Mobile Safari)。在 5。)中,当我再次登录时,应用程序进入后台,登录尝试在Facebook App / Mobile Safari中像往常一样重新进行,但是我正在屏幕上显示我'已经登录了:
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:
我可以从我的应用程序里面从Facebook(我的意思是全球范围)退出真的 ?这会影响使用Facebook凭据的其他应用程序,但是如果我不能这样做,我该如何避免上述奇怪的行为?
"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?
谢谢
推荐答案
恐怕答案是否定的,你不能这样做。
I'm afraid the answer is no, you can't do this.
您的应用程序位于沙箱中,无法在外面写入全局Cookie(适用于移动Safari)和Facebook应用设置(在Facebook应用程序偏好/我认为的cookies中)
Your application is in a sandbox, and can't write outside, where global cookies are (for mobile safari) and Facebook app settings (in Facebook app preferences/cookies I think)
您只能警告您的用户注销您的应用程序...
You can only warn your user to logout outside of your app...
...或者您也可以不使用facebook api SSO,但在应用程序登录webform,像我做的其他原因。
...Or you can just not use facebook api SSO, but in app login webform, like I do for other reasons.
如果您选择该选项此拉请求可能会节省一些时间;)
If you choose that option this pull request might save you some time ;)
这篇关于facebook-ios-sdk注销问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!