So you definitely can use OAuth 2 tokens to access the YouTube API
(I've successfully done it at http://code.google.com/p/gdata-samples/source/browse/trunk/gdata/captions_demo.py,
though that relies on a Python client library to handle most of the
OAuth 2 details). I've done it using the Authorization header
(Authorization: OAuth <token>) rather than the oauth_token URL
parameter, but that should probably work as well.
One thing to keep in mind is that OAuth 2 tokens expire fairly
quickly, and need to be refreshed using the refresh token. You're
responsible for doing this yourself, unless you have a library that
takes care of that for you. As a first step, I'd ensure that you're
using a fresh token.
Cheers,
-Jeff Posnick, YouTube API Team
~ YouTube is hiring! ~ http://google.com/jobs/workyoutube ~
On May 31, 6:12 am, Clive Jackson <developm...@illuminatu.com> wrote:
> Using OAuth 2.0, I have successfully gone through the authentication steps
> to obtain an oauth_token. The problem is that when I try to use the token I
> get a 401 error "Token invalid - Invalid AuthSub token".
>
> Java is reporting: Authentication error: Unable to respond to any of these
> challenges: {authsub=WWW-Authenticate: AuthSub
> service="youtube",realm="http://www.youtube.com/auth_sub_request"}
>
> The url is this (with personal info removed):
>
> http://gdata.youtube.com/feeds/api/videos?v=2&alt=json&location=51.51...<my
> developer key>&oauth_token=<oauth 2 token>
>
> I have tried using the key and oauth_token params both as is and url
> encoded, I have also tried passing them as headers but still with the same
> response. I'm using OAuth 2 to access Facebook, Twitter, Foursquare and
> Gowalla, so I'm fairly familiar with the process. Have I missed something
> stupid? Should I be using a different URL? Any help would be appreciated.
--
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