Php 上载到youtube(v3),getAccessToken失败

Php 上载到youtube(v3),getAccessToken失败,php,youtube-api,Php,Youtube Api,客户机id和密码是从JSON代码中我可以下载的(客户机id和客户机密码字段)。 因此,它失败了。我哪能不及格呢 编辑:$client->getAuth()->getAccessToken()返回“[]”这是php客户端库上的一个错误,刚刚得到修复 下载主分支 require_once ('Google/Client.php'); require_once ('Google/Http/MediaFileUpload.php'); require_once ('Google

客户机id和密码是从JSON代码中我可以下载的(客户机id和客户机密码字段)。 因此,它失败了。我哪能不及格呢


编辑:
$client->getAuth()->getAccessToken()
返回“[]”

这是php客户端库上的一个错误,刚刚得到修复

下载主分支

    require_once ('Google/Client.php');
    require_once ('Google/Http/MediaFileUpload.php');
    require_once ('Google/Service/Drive.php');

    $client = new Google_Client();
    $client->setClientId('clitentid');
    $client->setClientSecret('secret');
    $client->setRedirectUri('/');
    $client->addScope("https://www.googleapis.com/auth/drive");
    $service = new Google_Service_Drive($client);
    if ($client->getAccessToken())
    {
        echo __LINE__;die;
        $file = new Google_Service_Drive_DriveFile();
        $file->title = "Big File";
        $chunkSizeBytes = 1 * 1024 * 1024;

        // Call the API with the media upload, defer so it doesn't immediately return.
        $client->setDefer(true);
        $request = $service->files->insert($file);

        // Create a media file upload to represent our upload process.
        $media = new Google_Http_MediaFileUpload(
            $client,
            $request,
            'text/plain',
            null,
            true,
            $chunkSizeBytes
        );
        $media->setFileSize(filesize('myfile'));

        // Upload the various chunks. $status will be false until the process is
        // complete.
        $status = false;
        $handle = fopen('myfile', "rb");
        while (!$status && !feof($handle)) {
            $chunk = fread($handle, $chunkSizeBytes);
            $status = $media->nextChunk($chunk);
        }

        // The final value of $status will be the data from the API for the object
        // that has been uploaded.
        $result = false;
        if ($status != false) {
            $result = $status;
        }

        fclose($handle);
    }
    else
    {
        echo 'fail';
    }