facebookarchive / php-graph-sdk

The Facebook SDK for PHP provides a native interface to the Graph API and Facebook Login. https://developers.facebook.com/docs/php
Other
3.17k stars 1.96k forks source link

Unsupported post request when posting video to page #1118

Open jamzy118 opened 5 years ago

jamzy118 commented 5 years ago

Hello,

We have serious trouble with uploading a video to page. We are using non-resumable mode, videos are 1-2MB MP4 files. We proceed exactly as explained in the documentation.

So, we create a connector instance:

$this->fb = new Facebook(
                [
                    'app_id'                => $this->config['app_id'],
                    'app_secret'            => $this->config['app_secret'],
                    'default_graph_version' => 'v3.2',
                ]
            );
$this->fb->setDefaultAccessToken($this->config['app_access_token']);

create a payload like:

$data = [
    'title' => $this->message,
    'description' => $this->description,
    'source' => $this->fbConnector->videoToUpload($pathToFile);
]

and then we send it with:

$endpoint = '/'. $this->pageId . '/videos';
$this->fb->post($endpoint, $data, $this->pageAccessToken); 

Response we receive is:

[Facebook\Exceptions\FacebookAuthenticationException (100)]  
Unsupported post request.  

Uploading pictures and text-only updates works without issues. Uploading the same video file manually also works, so our MP4 files are ok. We tried various "default graph versions", but that doesn't change anything.

We are using latest 5.5 library version. It happens within OctoberCMS which comes with Guzzle 6.x, so we went through injecting own client per tutorial linked in repo description but it didn't change anything.

Any idea what may be wrong here? If there are any additional details that may help, please let me know.