facebook-ios-sdk 注销问题 [英] facebook-ios-sdk logout question

查看:27
本文介绍了facebook-ios-sdk 注销问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这里看到了很多关于 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:

  1. 进入应用程序(未创建accessToken/expirationDate).
  2. 通过调用 authorize:delegate: 方法使用 SSO 执行登录(应用程序进入后台并在全局"范围(Facebook 应用程序/移动 Safari)中进行登录,要求提供用户凭据.
  3. 返回应用程序(现在已登录,accessTokenexpirationDate 都保存到 NSUserDefaults).
  4. 通过调用 logout: 方法执行注销(现在注销了,accessTokenexpirationDate 都从 NSUserDefaults)
  5. 尝试再次登录,步骤与第 2 步完全相同.
  1. Enter in the app (no accessToken/expirationDate created).
  2. 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.
  3. Enter back in the app (now logged in, both accessToken and expirationDate are saved to NSUserDefaults).
  4. Perform a logout by calling the logout: method (now logged out, both accessToken and expirationDate are removed from NSUserDefaults)
  5. Attempt to perform a login again, with exactly the same steps done in 2.

我意识到当我调用 logout: 时,我确实从我的应用程序范围内从 Facebook 注销(accessToken 已失效),而不是从 global 范围(Facebook 应用程序/移动 Safari).在 5.) 中,当我再次尝试登录时,应用程序进入后台,并像往常一样在 Facebook 应用程序/移动 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,而是在应用程序登录网络表单中,就像我出于其他原因一样.

...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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆