douzhi1937 2012-05-20 21:27
浏览 44
已采纳

为什么Facebook PHP SDK logouturl实际上没有将用户注销?

I am using the Facebook PHP sdk, and after the user logs in, I show a link for the logout URL using $facebook->getLogoutUrl().

But when the user clicks on that link, it seems to go to Facebook and redirect right back to my main index.php at which point the user still seems to have been logged in, because $facebook->getUser(); returns a valid user.

How do I actually fully log the user out?

  • 写回答

1条回答 默认 最新

  • dongwujie7477 2012-05-20 21:36
    关注

    getLogoutUrl method returns a URL that, when clicked by the user, will log them out of their Facebook session and then redirect them back to your application.

    Ideally after logging the user out, user will be redirected back to the application but $facebook->getUser(); returns 0.

    This should help you.

    EDIT:

    Best way is to use something like below

    $logoutParams = array(
    'next'  =>  'http://your-site/your-application/after_logout.php'
    );
    

    and also destroy sessions session_destroy();

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 win11 23H2删除推荐的项目,支持注册表等
  • ¥15 matlab 用yalmip搭建模型,cplex求解,线性化处理的方法
  • ¥15 qt6.6.3 基于百度云的语音识别 不会改
  • ¥15 关于#目标检测#的问题:大概就是类似后台自动检测某下架商品的库存,在他监测到该商品上架并且可以购买的瞬间点击立即购买下单
  • ¥15 神经网络怎么把隐含层变量融合到损失函数中?
  • ¥15 lingo18勾选global solver求解使用的算法
  • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行
  • ¥20 测距传感器数据手册i2c
  • ¥15 RPA正常跑,cmd输入cookies跑不出来
  • ¥15 求帮我调试一下freefem代码