duancheng7743 2013-05-07 14:00
浏览 63
已采纳

facebook登录bug使用fb php sdk

My problem is the following. I have a website http://de.gamercharts.com/

You can connect with facebook(if you don't have an account,an account will be created). After this ,if you logout from the site ,you are logged out from facebook too. Everything is ok so far. The problem is that if I am logged out of the site (let's call the site GC) and logged out of facebook ,when I click "connect with facebook" on the site,I get logged in on the site,instead of being prompted to the facebook login screen. When I print the user ,I see that even though I am logged out of facebook,I still have the user id. Why does this happen,and how can I fix it ? Thanx a lot to anyone who takes the time to answer. For the record I am using Zend ,although I don't think it's relevant. I did not implement the facebook login myself,I am continuing the work of someone else.

  • 写回答

2条回答 默认 最新

  • dragon8899 2013-05-08 14:55
    关注

    The problem is caused due to existence of Facebook Session Variables in your domain/site, even after logging out from facebook and your site. When someone logs out from your site, one should take care to destroy all the sessions[even facebook sessions]. For destroying facebook sessions in your domain/site, you can make use of the function destroySession(); [provided in the facebook php sdk] in your logout script.

     $config = array();
     $config['appId'] = 'YOUR_APP_ID';
     $config['secret'] = 'YOUR_APP_SECRET';
     $facebook = new Facebook($config);
     $logout = $this->facebook->getLogoutUrl(array('next'=>'url to be redirected after logout'));
     $facebook->destroySession(); // To destroy facebook Sessions
     $session_destroy(); //To destroy sessions of your site
     header("Location:$logout");
    

    P.S Don't forget to include or call session_start() in the script

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥170 如图所示配置eNSP
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改
  • ¥20 wireshark抓不到vlan
  • ¥20 关于#stm32#的问题:需要指导自动酸碱滴定仪的原理图程序代码及仿真
  • ¥20 设计一款异域新娘的视频相亲软件需要哪些技术支持
  • ¥15 stata安慰剂检验作图但是真实值不出现在图上