1

我一直在寻找这个错误,但我仍然没有找到任何阻止它发生的东西,问题是它有时只会发生,而且我的错误日志上还有另一个错误

There exists a cookie that we wanted to clear that we couldn't clear because headers was already sent. Make sure to do the first API call before outputing anything
PHP Fatal error:  Uncaught OAuthException: An active access token must be used to query information about the current user. thrown in /...fb_sdk/base_facebook.php on line 1106

这是我在 config.php 上使用的代码,我在我的应用程序内的所有页面上使用它

<?php
    header('P3P:CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"');

    require 'fb_sdk/facebook.php';

   $app_id = 'XXXXXXXXXXXX';
   $app_secret = 'XXXXXXXXXXXX';
   $app_namespace = 'minstagram';
   $app_url = 'https://apps.facebook.com/' . $app_namespace . '/';
   $scope = 'email,publish_actions,user_photos,friends_photos';

   // Init the Facebook SDK
   $facebook = new Facebook(array(
     'appId'  => $app_id,
     'secret' => $app_secret,
     'cookie' => true
   ));

   // Get the current user
   $user = $facebook->getUser();

   // If the user has not installed the app, redirect them to the Auth Dialog
   if (!$user) {
     $loginUrl = $facebook->getLoginUrl(array(
       'scope' => $scope,
       'redirect_uri' => $app_url,
     ));

     print('<script> top.location.href=\'' . $loginUrl . '\'</script>');
   }


?>

所以这是我的问题,希望任何人都可以在这里帮助我,如果我目前拥有的acces_token无效,或者anythi.g。

4

0 回答 0