I'm desesperate, I created a new app for testing update from my fbml into the iframe app. I created the iframe app in other app.faceb... for testing... and today, the app works totally in the test created app url. I move the files to my public app and I changed the settings from FBML to iframe. Suddenly in the public app, appears the next error:
Fatal error: Uncaught OAuthException: An active access token must be used to query information about the current user. thrown in /var/www/mysite/apps/facebook/base_facebook.php on line 1039
What can I do? In the test apps facebook URL, it works fine, but in my public app URL, where was the old FBML app, it crashed :_(
<?php
require './config.php';
require './facebook.php';
$facebook = new Facebook(array(
'appId' => $fb_app_id,
'secret' => $fb_secret,
'cookie' => true,
));
$friends = array();
$sent = false;
$userData = null;
//redirect to facebook page
if(isset($_GET['code'])){
header("Location: " . $fb_app_url);
exit;
}
$user = $facebook->getUser();
if ($user) {
$userPermissions = $facebook->api('/me/permissions');
//get user data
if (($userPermissions["data"][0]["user_groups"] == 1) && ($userPermissions["data"] [0]["publish_stream"] == 1) && ($userPermissions["data"][0]["publish_stream"] == 1)){
$app_access = 1; //yes
}
else {
$app_access = 2; //no
$loginUrl = $facebook->getLoginUrl(array(
'canvas' => 1,
'fbconnect' => 0,
'scope' =>'publish_stream,status_update,user_groups,user_about_me,user_interests,user_likes',
));
}
try {
$userData = $facebook->api('/me');
} catch (FacebookApiException $e) {
//do something about it
}
} else {
$app_access = 2; //no
$loginUrl = $facebook->getLoginUrl(array(
'canvas' => 1,
'fbconnect' => 0,
'scope' => 'publish_stream,status_update,user_groups,user_about_me,user_interests,user_likes',
));
}
?>