I am actually trying to do about the same as Sudhish regarding the authentification. I would like to be able to get the youtube recommendation for a specific user. Could you provide some details about it? eg the parameters
Thanks in advance.
Yorick
On Wednesday, May 30, 2012 7:15:04 AM UTC+10, Jeffrey Posnick wrote:
Hello Sudhish,
Let's take a big step back here. You say your end goal is to play
private videos, but that's a complicated subject on the web-based
embedded player (it relies on the YouTube.com login cookie being
present, which has nothing to do with the Data API) and and even more
complicated subject, and potentially not possible, from an Android
application.
How were you planning on playing the video?
Cheers,
-Jeff Posnick, YouTube API Team
groups.google.com/group/youtube-api-gdata | apiblog.youtube.com |
@YouTubeDev
On May 27, 1:39 am, sudhish kapoor <kapoorsudh...@gmail.com> wrote:
> Hi Jeff,
> I get an Authorization token by using the function
>
> accountManagerFuture = mgr.getAuthToken(acct, "youtube", true, new
> AccountManagerCallback<Bundle>(
> {
>
> @Override
> public void run(AccountManagerFuture<Bundle> future) {
> try {
> Bundle bundle = future.getResult();
> if (bundle.containsKey(AccountManager.KEY_INTENT)) {
> Intent intent =
> bundle.getParcelable(AccountManager.KEY_INTENT);
> intent.setFlags(intent.getFlags() &
> ~Intent.FLAG_ACTIVITY_NEW_TASK);
> startActivityForResult(intent, 0);
> } else if
> (bundle.containsKey(AccountManager.KEY_AUTHTOKEN)) {
> my_access_token =
> bundle.getString(AccountManager.KEY_AUTHTOKEN);
> }
> } catch (Exception e) {
> Log.e("TEST", e.getMessage(), e);
> }
> }
> }, null);
>
> as mentioned inhttp://developer.android.com/training/id-auth/ authenticate.html
>
> After getting the authentication token i send the http request as
> <code>
> HttpClient lClient = new DefaultHttpClient();
> String postReq = ("https://gdata.youtube.com/feeds/api/users/default/ " +uploads?access_token=
> my_access_token);
> HttpPost lPostMethod = null;
> lPostMethod = new HttpPost(postReq);
> lPostMethod.addHeader("Authorization:Bearer", finalToken);
> HttpResponse lResp = null;
> lResp = lClient.execute(lPostMethod);
> lResp.getEntity().writeTo(lBOS);
> Log.i("RESP", lInfoStr);
> </code>
>
> The lInfoStr gives the output as "Response contains no content type"
>
> What needs to be done after this??
>
> Also, if i use the same "my_access_token" it cannot extract details(play
> private video).
>
> I did not see any information of how to set the "client id" "client secret"
> for the access token acquired by accounts manager. (for you tube which link
> to be used)
>
> The access token acquired by Account Manager and by OAuth2.0 request as
> mentioned in the below link do not match.
>
> The details mentioned for getting an access token for Installed application
> as described in:
>
> https://developers.google.com/youtube/2.0/developers_guide_ ..protocol_o.
>
> does not mention how to get the access token acquired by account manager on
> the device
> (and for the method mentioned above requires to open a web View but i want
> to do this process without user interaction)
>
> I am still stuck and want to get the you tube access to play the private
> videos by using the access token acquired by accounts manager on the device
>
> 1) Get auth_token from account Manger from device
> 2) Use the auth token to get the access for You tube.
> 3) Play the private video using "http://www.youtube.com/get_video_info?&video_id=xxxxxx& ..access_token=m.
> "
> 4) Do all this in without user interaction.
>
> How to do this??
>
> Regards,
> Sudhish Kapoor
>
>
>
>
>
>
>
>
>
> On Sat, May 26, 2012 at 1:29 AM, Jeffrey Posnick <je...@google.com> wrote:
> > Hello Sudhish,
>
> > If you get back a valid OAuth 2 token, you need to use it as
> > described at
>
> >https://developers.google.com/youtube/2.0/developers_ ..guide_protocol_o.
>
> > I'm assuming you're making the HTTP requests yourself rather than
> > using the Java client library, since the existing library doesn't work
> > well on Android. So you'd want to either include the token in the
> > request URL or set the Authorization HTTP header.
>
> > Cheers,
> > -Jeff Posnick, YouTube API Team
> > groups.google.com/group/youtube-api-gdata | apiblog.youtube.com |
> > @YouTubeDev
>
> > On May 24, 5:55 am, sudhish kapoor <kapoorsudh...@gmail.com> wrote:
> > > Hi All,
> > > I wanted to get the OAuth token to access you tube private videos.
> > > I am using Account Manager class to get the access token for the
> > > account logged in on device using "com.google. "
>
> > > I am populating the AuthToken using:
>
> > >http://developer.android.com/training/id-auth/authenticate. html
>
> > > I am unaware as to how to use the access token received from Account
> > > Manager and pass it to You tube for actual authentication.
>
> > > Or can i use the Token Directly??
>
> > > Regards,
> > > Sudhish Kapoor
>
> > --
> > 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 .
>
> --
> Regards,
> Sudhish Kapoor.
You received this message because you are subscribed to the Google Groups "YouTube APIs Developer Forum" group.
To view this discussion on the web visit https://groups.google.com/d/msg/youtube-api-gdata/-/BRsgnuL3DJYJ.
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