0

我正在使用google-api-nodejs-client并且我正在尝试编写一个上传器。我终于到了一切都经过 OAuth2 身份验证并且可以提出请求的阶段。

但是,当尝试上传时,我收到 403 - Download Service Forbidden 错误。谷歌搜索错误完全没有返回(这些天很少见),官方错误代码列表没有列出它。

我在下面附上了 JSON 响应。

 { errors:
   [ { domain: 'global',
       reason: 'downloadServiceForbidden',
       message: 'Download Service Forbidden' },
     [length]: 1 ],
  code: 403,
  message: 'Download Service Forbidden' }

有没有人看到这个或知道它的意思?

我的上传代码。

var yt_api = googleapis.discover('youtube', 'v3');

var auth_scopes = [
    "https://www.googleapis.com/auth/youtube",
    "https://www.googleapis.com/auth/youtube.upload",
    "https://www.googleapis.com/auth/youtubepartner"
]

var authClient = new googleapis.OAuth2Client(CLIENT_ID, CLIENT_SECRET, REDIRECT_URL);


//performs the authorisation with the above scopes
ensureAuthorisation(authClient, doRequest);


function doRequest() {

    log.msg('Executing...');
    yt_api.execute(function(err, client){

        // open the video as a stream
        var buffer = fs.readFileSync('../files/test.mp4');

        client
            .youtube.videos.insert({part: "contentDetails", mine: true})
            .withAuthClient(authClient)
            .withMedia('video/*', buffer)
            .execute(function(err, response){

                if (err) {
                    log.err("Error in upload");
                    dumpObj(err);
                } else {
                    log.msg("Succeeded!");
                }

            });

    });

}

谢谢!

4

0 回答 0