This is my code which i am using:
<?php
//NOTE: Replace the #placeholders# with your own values
//The user_token
$user_token = '99a088ef-ac7a-4252-b04b-d16c3e60257d';
//Your Site API Credentials
$site_subdomain = 'mysmarttoolapp';
$site_public_key = '90caae54-4fc1-4008-8972-cc782d69392b';
$site_private_key = 'd63d5a7c-1190-4d61-82f5-a134c6a37575';
//The resource to send the request to
$api_resource_uri = '
https://'.$site_subdomain . ".api.oneall.com/sharing/messages.json";
//The POST data to be included
$post_data = array(
'request' => array(
'sharing_message' => array(
'parts' => array(
'text' => array(
'body' => 'this is for test'
),
'picture' => array(
'url' => '
http://www.google.com/doodle4google/images/d4g_logo_global.jpg' ),
'link' => array(
'url' => '
http://mst.vnsinfo.com/',
'name' => 'mst.com',
'caption' => 'this is for test',
'description' => 'this is for testthis is for testthis is for test.'
),
'flags' => array(
'enable_tracking' => 1
)
),
'publish_for_user' => array(
'user_token' => $user_token,
'providers' => array('facebook')
)
)
)
);
//Setup CURL
$curl = curl_init ();
curl_setopt_array ($curl, array (
CURLOPT_URL => $api_resource_uri,
CURLOPT_USERPWD => $site_public_key . ":" . $site_private_key,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode($post_data)
));
//Send Request
$data = curl_exec ($curl);
//Error
if ($data === false)
{
echo 'Curl Error: ' . curl_error ($curl);
}
//Success
else
{
echo 'Received Result: ' . $data;
}
//Close connection
curl_close ($curl);
?>
the error is :
Received Result: {"response":{"request":{"date":"Wed, 22 Jul 2015 08:45:44 +0200","resource":"\/sharing\/messages.json","status":{"flag":"error","code":400,"info":"Your request could not be processed due to an error"}},"result":{"data":{"sharing_message":{"sharing_message_token":"0e16d20e-f518-49b6-9de5-159c1b8880fd","date_creation":"Wed, 22 Jul 2015 08:45:44 +0200","publications":{"count":1,"entries":[{"status":{"flag":"error_message_is_not_permitted","code":403,"message":"The provider did not accept the message: you do not have the permission to post on behalf of the user"},"provider":"facebook","user_token":"99a088ef-ac7a-4252-b04b-d16c3e60257d","identity_token":"ba7feb29-b376-4bb6-a914-7d3961342d54"}]}}}}}}
Answers
in your OneAll Facebook settings you have to tick this option:
Publish Actions - Post comments and likes on behalf of a user.
Then you need to relogin with Facebook in your OneAll Social Login implementation in order to update the permissions.
Then you should be able to post on behalf of the user.
Regards,
I have checked that permission in Facebook settings and that permission is present. After that I re-login into my Facebook account and its gives me the same error. I used the same code which i have mentioned in above. please suggest something that I can replicate the issue.
Thanks
David
Does your Facebook application have the necessary permission?
Posting requires approval by Facebook.
We get the same error message as you do, under when this permission is missing.
Hope this helps.