Facebook PHP SDK 注销
我已经在我的 facebook 应用程序注销选项中实现了,但不幸的是,它在 rediredt 循环上出错。有谁知道 facebook sdk 是否将我重定向回原始页面或在应用程序设置中设置的主页Developers.facebook.com 管理? 无论如何,是否有可能如何在不重定向的情况下从我的应用程序注销?例如,使用 cUrl 请求注销 url,这可能吗?
I've implemented in my facebook app logout option, but unfortunately, it errors on rediredt loop..Does anyone know if the facebook sdk, redirects me back to the original page, or to the main page whicj is set in the applications settings in developers.facebook.com administration??
Anyway, is there any possibility how to logout from my app without redirecting?For example with cUrl request to the logout url, is that possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以考虑使用 FB javascript SDK 进行注销,然后不需要重定向(也可以注册 javascript 回调并使用 window.location 来执行此操作):
FB.logout(function(response) {
// 用户现在已注销
窗口位置 = "xxxx";
});
如果你想使用php sdk,你可以传入一个“next”参数,其中包含你想要直接访问的页面:
$location = (string) html_entity_decode($facebook->getLogoutUrl(array('next' => 'mysite.com')));
You could consider using the FB javascript SDK for doing the logout and then you do not need to redirect (it is also possible to register a javascript callback and use window.location to do that):
FB.logout(function(response) {
// user is now logged out
window.location = "xxxx";
});
If you want to use the php sdk, you can pass in a "next" parameter, with the page you want to direcrect to:
$location = (string) html_entity_decode($facebook->getLogoutUrl(array('next' => 'mysite.com')));
当我想注销时,我只是销毁 php 会话。 Facebook-php-sdk 使用会话来存储持久数据,以跟踪登录详细信息。
这不会从 facebook 注销,但会让您的 facebook-php-sdk 认为您已经注销。
I just destroy the php session when I want to do a logout. Facebook-php-sdk uses sessions to store persistent data which keeps track of login details.
This doesn't logout from facebook but will make your facebook-php-sdk think you have logged out.
我也只使用
$facebook->destroySession()
注销对我来说不起作用,因为我正在重定向到登录页面,这让我保持登录状态。结束会话是最快的解决方案,我出于安全原因,我想从 FB 注销用户,只要他们从其他人的计算机访问我的应用程序
I also use just
$facebook->destroySession()
Logout just didn't work for me because i was redirecting to login page and that keeps me logged in. ending session was the quickest solution, and I wanted to logout user from FB also for security reasons, just if they are accessing my app from someone else's computer