获取 YouTube 用户个人资料失败,某些帐户显示 401 Unauthorized [英] Getting YouTube user profile fails with 401 Unauthorized for some accounts

查看:41
本文介绍了获取 YouTube 用户个人资料失败,某些帐户显示 401 Unauthorized的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过使用不支持的帐户进行身份验证,我能够在 OAuth 2.0 Playground 中复制此问题没有 YouTube 频道/用户名,并调用 Get User 方法 (https://gdata.youtube.com/feeds/api/users/default).

I was able to replicate this problem in the OAuth 2.0 Playground by authenticating with an account that doesn't have a YouTube channel/username, and calling the Get User method (https://gdata.youtube.com/feeds/api/users/default).

推荐答案

即使没有 YouTube 频道(即拥有 YouTube 用户名)也可以拥有 YouTube 帐户.Google 将此称为未关联帐户.

It is possible to have a YouTube account without having a YouTube channel (i.e. having a YouTube username). Google calls this an unlinked account.

YouTube API 2.0 版中定义的某些方法如果您在未关联的帐户上调用它们,则会引发 401 Unauthorized 错误.事实证明,有一个相对未公开的 YouTube API 版本(2.1 版)支持未关联帐户的功能.

Some methods defined in version 2.0 of the YouTube API will throw 401 Unauthorized errors if you call them on an unlinked account. It turns out that there is a relatively undocumented version of the YouTube API (version 2.1) that enables functionality for unlinked accounts.

更多信息:http://apiblog.youtube.com/2011/10/introducing-google-account-support-and.html

我能够通过简单地更改 OAuth 2.0 Playground 中的版本标头来修复GData-Version: 2.0GData-Version: 2.1.

I was able to fix the error in the OAuth 2.0 Playground by simply changing the version header from GData-Version: 2.0 to GData-Version: 2.1.

这篇关于获取 YouTube 用户个人资料失败,某些帐户显示 401 Unauthorized的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆