Facebook PHP SDK 清除会话数据?
我希望人们能够从我的应用程序的 Facebook 帐户中删除我的应用程序。
这很容易完成:
$fb->api('/'.$fbUid.'/permissions','DELETE');
问题是,如果用户在我的网站上加载另一个页面,facebook php sdk 似乎仍然认为用户已“登录”。我认为这是因为 facebook php sdk (v 3.1.1) 在会话中存储用户数据。
有没有好的方法来清除这些会话? (我的意思是最佳实践方法,当然我可以循环遍历会话并删除所有以“fb_”开头的内容)。
有一个 $fb->clearAllPercientData() 但它是受保护的。
或者我实际上必须将用户重定向到 logoutUrl 才能执行此操作?
编辑:重定向到 logoutUrl 没有任何区别,我仍然有会话变量。
I want people to be able to remove my app from their facebook-account from my app.
This is easily done with:
$fb->api('/'.$fbUid.'/permissions','DELETE');
The problem is that if the user loads another page on my website the facebook php sdk still seem to think that the user is "logged in". I think this is because the facebook php sdk (v 3.1.1) stores user data in sessions.
Is there a good way of clearing these sessions? (i mean a best practice way, of course i could loop through the sessions and delete all beginning with "fb_").
There is a $fb->clearAllPersistentData() but it's protected.
Or will i actually have to redirect the user to the logoutUrl to do this?
EDIT: Redirecting to logoutUrl doesn't make any difference, i still have the sessions variables.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 session_destroy() 但这会破坏所有会话数据,包括您自己的应用程序可能正在使用的任何数据。
另一个解决方案是扩展类并通过您自己的包装函数公开受保护的方法。
不过我同意这有点问题,我有一些修复,我将在本周推送到 sdk。
You can use session_destroy() but this will destroy all the session data, including any your own apps may be using.
Another solution is to extend the class and expose the protected method via your own wrapper function.
However I agree that this is slightly broken and I have a few fixes that I'll push to the sdk this week.