I have been looking for this error but I still have not found anything that prevents it from happening, the thing is that it only happens sometimes and also i get another error on my error´s log
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
Here is the code I am using on the config.php and I am using it on top of all the pages inside my app
<?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>');
}
?>
So here is my question, hope anybody can help me out here, maybe a way to get a new acces_token if the one i currently have is not valid, or anythi.g.