duannengling4705 2012-12-10 16:40
浏览 190

注销和access_token

I'm trying to simply log a user out of fb before continuing on to log them out of my system.

Here's what I'm trying:

require_once '/src/facebook.php';

    $facebook = new Facebook(array( 'appId'  => 'MY_APP_ID', 'secret' => 'MY_SECRET' ));
    $fb_userID = null;
    $fb_userID = $facebook->getUser();
    $access_token = $facebook->getAccessToken();

    if($fb_userID){

    $logoutUrl = $facebook->getLogoutUrl( array ('next' => 'http://myurl.com/pages/userlogin.html?logoff=true')); 

    }

echo "<a href="$logoutUrl">Log-out</a>";

When I do this not only does it not work but the end of the URL shows access_token=0

If I try the following instead I get the access token but it stil doesn't work

$logoutUrl = "https://www.facebook.com/logout.php?next=http://myurl.com/pages/userlogin.html?logoff=true&access_token=$access_token";

Is there a better way of doing this?

  • 写回答

1条回答 默认 最新

  • douxiegan6468 2012-12-11 01:54
    关注

    To force a logout when getLogoutUrl doesn't work:

    $app_config = array(
      'appId' => '1234567',
      'secret' => '7722b9foobar00foobar'
    );
    $facebook = new Facebook($app_config);
    $facebook->destroySession();
    session_destroy();
    
    评论

报告相同问题?

悬赏问题

  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?
  • ¥15 matlab(相关搜索:紧聚焦)
  • ¥15 基于51单片机的厨房煤气泄露检测报警系统设计
  • ¥15 Arduino无法同时连接多个hx711模块,如何解决?
  • ¥50 需求一个up主付费课程
  • ¥20 模型在y分布之外的数据上预测能力不好如何解决