I've been able to post Open Graph actions using my own account, but I'm unable to do the same as a Test User of the application, receiving this error:
OAuthException: An unexpected error has occurred. Please retry your request later.
I've tested the access token that I'm using with the debugger and it's fine.
Here's the code I'm using - I'm pretty sure the code is fine, because it works when I'm logged in as myself:
$token = $this->facebook->getAccessToken();
$params = array(
'access_token' => $token,
'{object}' => 'http://samples.ogp.me/{objectID}',
);
try
{
$result = $this->facebook->api('/me/{namespace}:{action}', 'POST', $params);
echo $result;
}
catch(FacebookApiException $e)
{
echo $e;
}
This question: Unable to use Test Users for posting through Open Graph seems to have a similar problem, but the fix posted doesn't work for me (I've tried creating test users through the Roles section, and via the graph API).
Has anyone been able to post actions when logged in as a test user?
The problem I was having was caused by setting 'Sandbox Mode' to 'enabled' in App Settings > Advanced.
The following page suggests enabling Sandbox Mode when testing the app, but Test Users can't publish Open Graph actions in Sandbox Mode.
来源:https://stackoverflow.com/questions/8898851/unable-to-post-open-graph-actions-as-a-test-user