PHP API Youtube Uploads, exception: Failed to start the resumable upload, upload must be sent to the upload URL PHP API Youtube Uploads, exception: Failed to start the resumable upload, upload must be sent to the upload URL php php

PHP API Youtube Uploads, exception: Failed to start the resumable upload, upload must be sent to the upload URL


This seems to be a problem with PHP Client Library of Google API. Go to GOOGLE_LIB_PATH/Http/MediaFileUpload.php and replace this line:

$this->request->setBaseComponent($base . '/upload'); 

With this one:

$this->request->setBaseComponent($base . 'upload'); 

Try again and share the results. I faced a similar problem with Google Pubsub API where API path set by library was incorrect.


There is a google method to get the refresh token, so instead of using json_decode :

$newToken = json_decode($client->getAccessToken());$client->refreshToken($newToken->refresh_token);

You can do :

$client->refreshToken( $client->getRefreshToken() );