会话不会在旧的Facebook iframe应用程序失效 [英] Session does not invalidating in old facebook iframe app

查看:145
本文介绍了会话不会在旧的Facebook iframe应用程序失效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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.

我使用的是CodeIgniter框架,并已引用帖子。这是代码片段:

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);

在输出中,即使用户注销后,尝试了很多事情后,我创建了一个新的Facebook应用程序,并指向这些URL我的同一个代码。
我修改了代码,并使用AppId,Appkey和AppSecret提供这个新的Facebook应用程序。一切都很好。

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.

两个Facebook应用程序中的设置是完全相同的。唯一的变化是appURL和keys。这是奇怪的行为,而不是一个可以接受的解决方案。我想让我的旧Facebook应用程序使用新的Facebook API。为什么会发生这种情况?任何想法?

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?

推荐答案

我有同样的问题,要解决这个问题,我不得不手动破坏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;

之前:

$ this-> facebook = new Facebook(...

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

所以每次创建一个新的facebook类,它会破坏旧的会话的cookie形式。

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

这篇关于会话不会在旧的Facebook iframe应用程序失效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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