我收到此错误:
Fatal error: Uncaught OAuthException: An active access token must be used to query information about the current user. thrown in
只有使用HTTPS的用户才会遇到这种情况,因为我将我的应用托管在没有SSL的托管上。所以我使用2托管。
我将我的应用程序从非SSL托管添加到iframe到我的SSL主机,然后出现此错误...
这是我的代码:
<?php
require "../fbapi/src/facebook.php";
$app_id = "xxxxxxxxx";
$app_secret = "xxxxxxxxxxxx";
$facebook = new Facebook(array(
'appId' => $app_id,
'secret' => $app_secret,
'cookie' => true
));
$facebook->setFileUploadSupport(true);
//Create an album
$album_details = array(
'message'=> 'Testing album from app',
'name'=> 'TEST'
);
$create_album = $facebook->api('/me/albums', 'post', $album_details);
//Get album ID of the album you've just created
$album_uid = $create_album['id'];
//Upload a photo to album of ID...
$photo_details = array(
'message'=> 'Hi, AMAZING!!!'
);
$file='../../nothing.png'; //Example image file
$photo_details['image'] = '@' . realpath($file);
$upload_photo = $facebook->api('/'.$album_uid.'/photos', 'post', $photo_details);
try{
$res = $facebook->api('/me/feed','POST',$post);
} catch (Exception $e){
echo $e->getMessage();
}
?>
如何在此iframe中使用access token? 谢谢!