I want to upload a video from s3 to youtube. Now i am using service account and get access token but when I upload video to youtube server return error:
[Google_Service_Exception]
{
"error": {
"errors": [
{
"domain": "youtube.header",
"reason": "youtubeSignupRequired",
"message": "Unauthorized",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Unauthorized"
}
}
This is my code:
$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);
....
I don't know Can use service account to upload a video to youtube api V3?
Please help me . thank you so much.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire