我想将视频从s3上传到youtube。现在我正在使用服务帐户并获取访问令牌但是当我将视频上传到youtube服务器时返回错误:
[Google_Service_Exception]
{
"error": {
"errors": [
{
"domain": "youtube.header",
"reason": "youtubeSignupRequired",
"message": "Unauthorized",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Unauthorized"
}
}
这是我的代码:
$googleClient = new Google_Client();
$googleClient->useApplicationDefaultCredentials();
$googleClient->setApplicationName('XXX');
$googleClient->setClientId('XXX');
$googleClient->setClientSecret('XXXX');
$googleClient->addScope(\Google_Service_YouTube::YOUTUBE);
$googleClient->setAccessType('XXX');
$googleClient->setApprovalPrompt('auto');
$googleClient->setDeveloperKey('XXX');
$stringAccessToken = $googleClient->fetchAccessTokenWithAssertion()['access_token'];
$googleClient->setAccessToken($stringAccessToken);
$youtube = new \Google_Service_YouTube($googleClient);
....
我不知道可以使用服务帐户将视频上传到youtube api V3吗?
请帮帮我。非常感谢你。