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条)

报告相同问题?

悬赏问题

  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了