Zend framework 使用我的应用程序&x27;国书

Zend framework 使用我的应用程序&x27;国书,zend-framework,google-api,youtube-api,oauth-2.0,zend-gdata,Zend Framework,Google Api,Youtube Api,Oauth 2.0,Zend Gdata,我的网站允许用户将视频上传到我的youtube帐户。为了将我的应用程序连接到Google(youtube),我使用了组件ClientLogin,如下所示: //my credentials $user = 'mymail@gmail.com'; $pass = 'mypass'; $service = 'youtube'; $developerKey = 'mydevkey'; //create the http client $httpClient = Zend_Gdata_ClientLo

我的网站允许用户将视频上传到我的youtube帐户。为了将我的应用程序连接到Google(youtube),我使用了组件ClientLogin,如下所示:

//my credentials
$user = 'mymail@gmail.com';
$pass = 'mypass';
$service = 'youtube';
$developerKey = 'mydevkey';

//create the http client
$httpClient = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $service, null,
                Zend_Gdata_ClientLogin::DEFAULT_SOURCE,null,null,
                Zend_Gdata_ClientLogin::CLIENTLOGIN_URI,'GOOGLE');
$httpClient->setHeaders('X-GData-Key', 'key='. $developerKey);

//create the instances
$youTubeService = new Zend_Gdata_YouTube($httpClient);
$newVideoEntry = new Zend_Gdata_YouTube_VideoEntry();
$newVideoEntry->setVideoTitle("test video");
$newVideoEntry->setVideoDescription("just testing");
$newVideoEntry->setVideoCategory("Music");
$newVideoEntry->setVideoTags('test, api');

//call the API to get the upload url and token
$tokenHandlerUrl = 'https://gdata.youtube.com/action/GetUploadToken';
try {
    $tokenArray = $youTubeService->getFormUploadToken($newVideoEntry, $tokenHandlerUrl);
} catch (Exception $e) {

}
$tokenValue = $tokenArray['token'];
$postUrl = $tokenArray['url'];

但是现在ClientLogin已被弃用:S,我需要使用oAuth 2。。。但是我一直在阅读文档,文档中没有提到使用我的应用程序凭据(不是用户凭据)进行连接。有没有办法使用oAuth复制此代码?

理论上,使用OAuth2复制此代码的方法是使用服务帐户:

在API控制台中设置帐户后,它将允许服务器到服务器的交互。不幸的是,Youtube API还不支持服务帐户:


希望这种支持很快就会到来(至少在ClientLogin消失之前!)

我也在尝试找到解决方案。你是怎么做到的?我现在不得不这样做。我已经读到ClientLogin仍然是,所以我想现在还可以,直到我找到更好的解决方案。是的,我想信息是正确的:。非常感谢你!