ZF-8028: Get the YoutubeUser from ClientLogin

Issue Type: Patch Created: 2009-10-07T09:49:44.000+0000 Last Updated: 2012-11-20T20:52:38.000+0000 Status: Closed Fix version(s): Reporter: Eugene (smileua) Assignee: None Tags: - Zend_Gdata

Related issues: Attachments: - youtube-internal-username.diff


Currently Youtube api provides authentication by [youtube-username, password] or by [gmail-useremail, gmail-password]. That's good, but sometimes makes troubles. Let's consider example: I logged in through ClientLogin by gmail-useremail and gmail-password. But further to deal with api I need specify youtube-username instead gmail-useremail. For instance, retrieving own videos Youtube api expects only youtube-username, not gmail-useremail. How can I get that youtube-username logging in by gmail account? I know the in this case returns YouTubeUser with Auth token ( see Zend_Gdata_ClientLogin::getHttpClient 146-153 ). But how can I get it in my code? It seems to me patching the ZF a little ( to save the YouTuberUser also with Auth token) is that way.



Posted by Eugene (smileua) on 2009-10-12T06:46:47.000+0000

This patch allows to retrieve the internal Youtube username from auth requests (in case you are registered by gmail account and authenticated by gmail email/password).

There are couple notices here: - Retrieving ClientLogin instance you have to provide to Zend_Gdata_ClientLogin::getHttpClient $loginUri as ''…'' instead of '''' (the otherwise Youtube will not provide internal username) - Also in Zend_Gdata_ClientLogin::getHttpClient you have to provide $client as instance of Zend_Gdata_YoutubeHttpClient (instances of Zend_Gdata_HttpClient don't know how to get internal youtube username) or to leave as null (in this case Zend_Gdata_ClientLogin::getHttpClient automatically creates required client type)

Posted by Eugene (smileua) on 2009-10-13T02:19:10.000+0000

I've attached patch that can fetch Youtube internal username, let's see an example

<pre class="highlight">

$authenticationURL = "https://<a href=""></a>";
$client = new Zend_Gdata_YoutubeHttpClient();

$httpClient = Zend_Gdata_ClientLogin::getHttpClient(
                                         "", $password,
                                         $service = "youtube",
                                         $loginToken = null,
                                         $loginCaptcha = null,
if ( $httpClient instanceof Zend_Gdata_YoutubeHttpClient ){
   $internalYoutubeUsername = $httpClient->getActualYoutubeUsername();
   // $internalYoutubeUsername is something like 'youtubeuser', so you can do
   $api = new Zend_Gdata_YouTube( $httpClient, $applicationId, $clientId, $developerKey );
   $api->getUserUploads ( $internalYoutubeUsername );
   // though last is same as $api->getUserUploads ( 'default' );

Posted by Rob Allen (rob) on 2012-11-20T20:52:38.000+0000

Bulk change of all issues last updated before 1st January 2010 as "Won't Fix".

Feel free to re-open and provide a patch if you want to fix this issue.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.