旧版 facebook iframe 应用程序中的会话不会失效

发布于 2024-10-11 04:09:16 字数 779 浏览 0 评论 0原文

我面临着一个非常奇怪的问题。大约一年前,我开发了一个 Facebook iframe 应用程序。我正在使用 facebook-php-sdk 来登录用户会话和其他详细信息。我最近做了一些更改并使用了新的基于 facebook OAuth 的 API。但我现在面临一个问题,当用户从 Facebook 注销时,我的 iframe 应用程序仍然能够访问其 Facebook 会话。该问题只能在 IE 中重现。

我正在使用 CodeIgniter 框架并引用了

$this->facebook = new Facebook(array( 'appId' => $this->appId, 'secret' => $this->secretKey, 'cookie' => true, ));
$this->session = $this->facebook->getSession();
var_dump($this->session);

在输出中,即使用户注销后,我也会获得所有有效的会话值。在尝试了很多事情之后,我创建了一个新的 Facebook 应用程序,并将 URL 指向我的相同代码。 我修改了代码并使用了这个新的 facebook 应用程序提供的 AppId、Appkey 和 AppSecret。现在一切正常。

两个 Facebook 应用程序中的设置完全相同。唯一的变化是 appURL 和密钥。这是奇怪的行为,对我来说不是一个可以接受的解决方案。我希望我的旧 Facebook 应用程序能够与新的 Facebook API 配合使用。为什么会发生这种情况?有什么想法吗?

I am facing a very strange issue. I have developed a Facebook iframe application almost a year back. I am using facebook-php-sdk for getting logged in user session and other details. I recently made some changes and used the new facebook OAuth based API. But I am now facing a problem, when user logs out from Facebook, still my iframe app is able to access its facebook session. The problem is only reproducible in IE.

I am using CodeIgniter framework and have referred this post. Here is the code snippet:

$this->facebook = new Facebook(array( 'appId' => $this->appId, 'secret' => $this->secretKey, 'cookie' => true, ));
$this->session = $this->facebook->getSession();
var_dump($this->session);

In output I get all the valid session values even after user is logged out. After trying many things, I created a new facebook application andd pointed the URLs to my same code.
I modified the code and used AppId, Appkey and AppSecret provided by this new facebook app. Everything works fine now.

The settings in both facebook apps are absolutely same. The only change is the appURL and keys. This is strange behavior, and not an acceptable solution for me. I want my old facebook app to work with new Facebook API. why this is happening? Any idea?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

只是偏爱你 2024-10-18 04:09:16

我遇到了同样的问题,为了解决这个问题,我必须手动销毁 facebook cookie(其中包含访问令牌)

所以:

添加:
$_COOKIE["fbs_" . $this->appId] = null;
之前:
$this->facebook = new Facebook(...

因此每次创建新的 facebook 类时,它都会首先销毁旧会话中的 cookie。

I had the same problem, and to fix this I had to manually destroy the facebook cookie (which contains the access token)

SO:

add:
$_COOKIE["fbs_" . $this->appId] = null;
before:
$this->facebook = new Facebook(...

so each time it creates a new facebook class it destroys the cookie form the old session first.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文