I use facebook login to my website
window.fbAsyncInit = function() {
FB.init({
appId : 'XXX',
channelUrl : 'XXX/channel.php',
cookie : true,
frictionlessRequests: true
});
};
The problem is that I go to my site every ~ 10-20 minutes. On the site this is what the reboot is, and I logged in again. I think the cookies are somehow deleted.
Is there any way to extend this cookie?
My login is as follows:
FB.login(function(response) {}, {scope:'publish_actions'});
Update:
This part of my script is called when the user logs in for the first time:
if (isset($_GET['first_login'])) {
if ($me) {
$facebook->setExtendedAccessToken();
$friends = $facebook->api('/me/friends');
$friends = $friends['data'];
if (!empty($friends)) {
}
$permissions = $facebook->api("/me/permissions");
if( array_key_exists('publish_actions', $permissions['data'][0]) ) {
$attachment = array(
'message' => 'XXX',
'name' => 'XXX - App',
'link' => 'XXX',
'description' => 'XXX',
'picture'=> 'XXX',
'access_token' => $facebook->getAccessToken()
);
$facebook->api('/'.$facebook->getUser().'/feed', 'POST', $attachment);
}
header('Location: http:/xxx');
}
}
But I get an error
Fatal error: OAuthException could not be thrown: (# 1) An error occurred while creating the share received in / facebook / base _facebook.php on line 1254
What caused $facebook->api('/'.$facebook->getUser().'/feed', 'POST', $attachment);
When I remove an attribute linkfrom mine $attachment, it works. Is the link attribute prohibited or something else?