$ facebook-> getLogoutUrl();链接不会将用户登录在Facebook之外 [英] $facebook->getLogoutUrl(); link doesn't log user out of facebook

查看:95
本文介绍了$ facebook-> getLogoutUrl();链接不会将用户登录在Facebook之外的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我当前的用户故事是user1已登录到我的网站和Facebook(这些帐户被连接到等等)。

My current user story is that user1 is logged into my website and facebook (these accounts are connected etc).

User1从我的网站注销但不是Facebook。

User1 logs out of my site but not facebook.

此用户2登录到他的帐户后,但是用户1与用户2与我的站点的互动以及他们发布的内容的左侧会话。

After this user2 logs into his account, but the left over session from user1 screws with user2's interaction with my site and who they post as.

所以要解决这个问题,我检查了登录的用户是否真的拥有当前登录的Facebook(这将导致他们进入facebook注销等),并显示一个应该允许用户注销...

So to fix this I made it check if the user who is logged in actually owns the currently logged in facebook (this would result in them going to facebook log out etc) and it shows a link that should allow the user to log out...

点击链接后,他们转到Facebook并返回网站。但是如果您打开一个新的标签并转到Facebook User1仍然登录。

Upon clicking the link they go to facebook and return to the site. But if you open a new tab and go to facebook User1 is still logged in.

如何让这个链接工作..发生了什么。这是api的一个错误还是什么?...

How can I get this link to work.. what's going on. Is this a bug with the api or what?...

编辑:我继续测试用户ID加载和有效的访问令牌,但我还没有取消注销链接。

I've continued testing with value user ids loading and with valid access tokens but I have yet to get the logout link to work.

推荐答案

有点迟到,但这里是我的贡献:

A little late but here goes my contribution:

当您生成注销网址时,使用参数,然后重定向到使用Facebook API功能销毁会话的页面。

Use the params when you generating the logout url, there redirects to a page in which you destroy the session using the Facebook API function for that.

这里有一个例子:

$logoutUrl = $facebook->getLogoutUrl(array("next" => "http://mydomain.com/page4logout"));

在page4logout中,您可以对Facebook对象进行实例执行以下操作:

In the page4logout you can instance the facebook object and execute the following:

$facebook->destroySession();

之后,您可以执行重定向。

After that you can do a redirection.

这篇关于$ facebook-> getLogoutUrl();链接不会将用户登录在Facebook之外的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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