简体   繁体   English

Facebook PHP SDK注销

[英]Facebook PHP SDK logout

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?? 我已经在我的Facebook应用程序注销选项中实现了,但是不幸的是,它在rediredt循环上出错。有人知道吗,如果是Facebook sdk,会将我重定向回原始页面,或者重定向到主页中的应用程序设置中设置的页面developers.facebook.com管理? 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? 无论如何,有没有可能在不重定向的情况下从我的应用程序注销?例如,使用cUrl请求到注销URL,这可能吗?

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 javascript SDK进行注销,然后无需重定向(也可以注册javascript回调并使用window.location来做到这一点):

FB.logout(function(response) { // user is now logged out window.location = "xxxx"; }); FB.logout(function(response){//用户现在已退出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 sdk,则可以传递“ next”参数,并将页面定向到:$ location =(string)html_entity_decode($ facebook-> getLogoutUrl(array('next'=>' mysite.com')));

I just destroy the php session when I want to do a logout. 我想注销时就破坏了php会话。 Facebook-php-sdk uses sessions to store persistent data which keeps track of login details. Facebook-php-sdk使用会话存储持久性数据,从而跟踪登录详细信息。

This doesn't logout from facebook but will make your facebook-php-sdk think you have logged out. 这不会从facebook注销,但会使您的facebook-php-sdk认为您已注销。

I also use just $facebook->destroySession() 我也只使用$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 登出对我不起作用,因为我正在重定向到登录页面,这使我保持登录状态。结束会话是最快的解决方案,出于安全原因,我也想从FB登出用户,即使他们正在从FB访问我的应用别人的电脑

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM