Thursday, January 19, 2012

[YouTube-API] Re: Using a sessionToken two times

Hello Ludo,

That doesn't sound like an issue with reusing a session token.
(They're meant to be reused, after all.) It might be necessary to call
getFullVideoEntry(video_id) to get an editable version of the video
entry in this scenario; I'm not entirely sure what the PHP library is
doing under the hood, and video entries from the uploads feed are
normally editable, but the docs suggest that it's necessary in at
least some scenarios:

http://code.google.com/apis/youtube/2.0/developers_guide_php.html#Identifying_Editable_Video_Entries

If you wanted to rule out an expired token completely, try passing in
the string "default" instead of the $userName variable; "default"
should be evaluated to whatever the currently authenticated user is by
the API server.

Cheers,
-Jeff Posnick, YouTube API Team
groups.google.com/group/youtube-api-gdata | apiblog.youtube.com |
@YouTubeDev


On Jan 18, 9:42 am, Ludo <ludovic....@gmail.com> wrote:
> Hi, i would like to update some video descriptions. I do it without
> problem on a page where i get a token , but i would like to do that on
> another place (in a controller) but i fail at the moment to exec
> $video->getEditLink()->getHref();.
>
> I think it's because i don't have anymore permission in my controller,
> to do that, i send the sessionToken that i generated previously in my
> view, and i use it again (in my controller).
>
> Apparently this method is not working.
>
> Let's see some code:
>
> In my view (That's work):
> $sessionToken =
> Zend_Gdata_AuthSub::getAuthSubSessionToken($_GET['token']);
> $httpClient = Zend_Gdata_AuthSub::getHttpClient($sessionToken);
> $yt = new Zend_Gdata_YouTube($httpClient, $applicationId, $clientId,
> $developerKey);
> $videoFeed = $yt->getUserUploads($userName);
>
> foreach($videoFeed as $video)
> {
> $description = $video->getVideoDescription();
> $video-
> >setVideoDescription($description);
>
> $Url = $video->getEditLink()->getHref();
>
> $yt->updateEntry($video,
> $putUrl);
>
> In my controller ($video->getEditLink()->getHref() fail)
> $sessionToken = $_POST['sessionToken'] (this one i used on my view
> just before)
> $httpClient = Zend_Gdata_AuthSub::getHttpClient($sessionToken);
> $yt = new Zend_Gdata_YouTube($httpClient, $applicationId, $clientId,
> $developerKey);
> $videoFeed = $yt->getUserUploads($userName);
>
> foreach($videoFeed as $video)
> {
> $description = $video->getVideoDescription();
> $video-
> >setVideoDescription($description);
>
> $Url = $video->getEditLink()->getHref();    /
> *FAIL*/
> $yt->updateEntry($video, $putUrl);
>
> thanks for help !

--
You received this message because you are subscribed to the Google Groups "YouTube APIs Developer Forum" group.
To post to this group, send email to youtube-api-gdata@googlegroups.com.
To unsubscribe from this group, send email to youtube-api-gdata+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/youtube-api-gdata?hl=en.

No comments:

Post a Comment