Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
How to get Authentication token for Youtube using account Manager
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
sudhish kapoor  
View profile  
 More options May 24 2012, 5:55 am
From: sudhish kapoor <kapoorsudh...@gmail.com>
Date: Thu, 24 May 2012 02:55:19 -0700 (PDT)
Local: Thurs, May 24 2012 5:55 am
Subject: How to get Authentication token for Youtube using account Manager
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 must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jeffrey Posnick  
View profile   Translate to Translated (View Original)
 More options May 25 2012, 3:59 pm
From: Jeffrey Posnick <je...@google.com>
Date: Fri, 25 May 2012 12:59:31 -0700 (PDT)
Local: Fri, May 25 2012 3:59 pm
Subject: Re: How to get Authentication token for Youtube using account Manager
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:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
sudhish kapoor  
View profile  
 More options May 27 2012, 1:39 am
From: sudhish kapoor <kapoorsudh...@gmail.com>
Date: Sun, 27 May 2012 11:09:23 +0530
Local: Sun, May 27 2012 1:39 am
Subject: Re: [YouTube-API] Re: How to get Authentication token for Youtube using account Manager

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 in
http://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

--
Regards,
Sudhish Kapoor.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jeffrey Posnick  
View profile   Translate to Translated (View Original)
 More options May 29 2012, 5:15 pm
From: Jeffrey Posnick <je...@google.com>
Date: Tue, 29 May 2012 14:15:04 -0700 (PDT)
Local: Tues, May 29 2012 5:15 pm
Subject: Re: How to get Authentication token for Youtube using account Manager
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:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Yorick Maziere  
View profile  
 More options Jul 11 2012, 2:45 am
From: Yorick Maziere <yorick.mazi...@gmail.com>
Date: Tue, 10 Jul 2012 23:45:03 -0700 (PDT)
Local: Wed, Jul 11 2012 2:45 am
Subject: Re: How to get Authentication token for Youtube using account Manager

Hello Jeffrey,

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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jeffrey Posnick  
View profile  
 More options Jul 24 2012, 5:03 pm
From: Jeffrey Posnick <je...@google.com>
Date: Tue, 24 Jul 2012 14:03:04 -0700 (PDT)
Local: Tues, Jul 24 2012 5:03 pm
Subject: Re: How to get Authentication token for Youtube using account Manager

Hello Yorick,

 There's some sample code to get an authentication token using the Android
AccountManager at

  http://code.google.com/p/ytd-android/source/browse/trunk/src/com/goog...

 Once the new Google Play Services framework has launched, that will
probably be the best way to get authentication tokens from Android:

  https://developers.google.com/android/google-play-services/
  https://developers.google.com/android/google-play-services/reference/...

Cheers,
-Jeff Posnick, YouTube API Team
apiblog.youtube.com | Google+: http://goo.gl/bZflZ


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »