Youtube api 通过身份验证的YouTube数据v3查询失败,出现403条禁止消息

Youtube api 通过身份验证的YouTube数据v3查询失败,出现403条禁止消息,youtube-api,Youtube Api,这是一个c#.NET应用程序。该应用程序进行了一个OAuth2认证的YouTube数据v3频道列表查询,该查询已经运行了两个月。最近,查询失败,谷歌发出403条禁止信息。它在我们的Azure Web服务器上以及在开发人员桌面上的Visual Studio中运行时失败。查询至少对一个用户有效,但对所有其他测试用户无效。查询(此处列出)适用于API资源管理器中的所有用户。我找不到从Google返回的其他错误描述 更新(2013年7月15日):在向查询添加访问令牌后,查询现在运行。以前,它仅在服务对象

这是一个c#.NET应用程序。该应用程序进行了一个OAuth2认证的YouTube数据v3频道列表查询,该查询已经运行了两个月。最近,查询失败,谷歌发出403条禁止信息。它在我们的Azure Web服务器上以及在开发人员桌面上的Visual Studio中运行时失败。查询至少对一个用户有效,但对所有其他测试用户无效。查询(此处列出)适用于API资源管理器中的所有用户。我找不到从Google返回的其他错误描述

更新(2013年7月15日):在向查询添加访问令牌后,查询现在运行。以前,它仅在服务对象中使用access_令牌成功执行,而不是显式执行查询的一部分。尽管直接附加access_令牌后查询成功,但我们在YouTube嵌入式播放器上发现了一个下游JavaScript错误。不确定这是否相关。我知道在六月底有一个.NETAPI更新@Ikailan在Google做了一些更改,以破坏服务对象中的访问令牌身份验证。注意:我们确实更新了新的API使用2013年6月的API更新是否需要对我们的代码进行更改?

错误消息“远程服务器返回错误:(403)禁止。”

方法失败,但现在与添加到查询中的身份验证令牌一起使用

//Gets the channel information of the current user
public static ChannelListResponse GetCurrentUserChannel(string token)
{
    YouTubeService service = new YouTubeService(GlobalSettings.applicationName, GlobalSettings.developerKey);
    GAuthSubRequestFactory authFactory = new GAuthSubRequestFactory("YouTube", GlobalSettings.applicationName);
    authFactory.Token = token;
    service.RequestFactory = authFactory;

    ChannelListResponse response = new ChannelListResponse();

    try
    {
        System.IO.Stream resultStream = service.Query(new Uri("https://www.googleapis.com/youtube/v3/channels?part=id%2Csnippet%2CcontentDetails%2Cstatistics%2CtopicDetails&mine=true&access_token=" + authFactory.Token));
        using (var reader = new System.IO.StreamReader(resultStream))
        {
            string value = reader.ReadToEnd();
            response = JObject.Parse(value).ToObject<ChannelListResponse>();
        }
    }
    catch (Exception ex) { }
    return response;
}
但是,我们得到一个嵌入式YouTube视频播放器的访问被拒绝错误

A first chance exception of type 'System.Threading.ThreadAbortException' occurred in mscorlib.dll
An exception of type 'System.Threading.ThreadAbortException' occurred in mscorlib.dll but was not handled in user code
Exception was thrown at line 4224, column 4 in http://localhost:49185/YotaCast_Prototype/Scripts/jquery-1.9.1.js
0x800a139e - JavaScript runtime error: SyntaxError
Exception was thrown at line 4242, column 4 in http://localhost:49185/YotaCast_Prototype/Scripts/jquery-1.9.1.js
0x800a139e - JavaScript runtime error: SyntaxError
Exception was thrown at line 360, column 9 in http://localhost:49185/YotaCast_Prototype/Scripts/foundation/foundation.js
0x800a1391 - JavaScript runtime error: 'Zepto' is undefined
Exception was thrown at line 1, column 97 in http://s.ytimg.com/yts/jsbin/www-embed-player-vflXN6WzI.js
0x80070005 - JavaScript runtime error: Access is denied.

我们需要更多的细节来开始帮助。是否每个用户都要通过3条腿的OAuth流?你们是在使用长寿命令牌,还是你们得到了一个短命的访问令牌并让它过期了?如果您可以打印出访问令牌,请将其作为参数传递到此URL:每个用户每次访问Web应用程序时都会通过OAuth流(不确定是哪种三条腿的OAuth流?)。谷歌为每个用户提供了允许的特定范围。这是一个短期访问令牌。我们仅在给定用户登录到我们的应用程序(当前会话)时访问该用户的API。我上传了一个访问令牌。“范围”:“,”过期时间:2178,@IkaiLan你今天能帮忙吗?你需要我给你更多吗?是的,看起来你用的范围不对。您正在使用分析范围和用户信息范围。通道列表的读/写范围为。只读作用域为。如果你能在原始评论中发布你的代码,我会在下面写一个更长的答案。
A first chance exception of type 'System.Threading.ThreadAbortException' occurred in mscorlib.dll
An exception of type 'System.Threading.ThreadAbortException' occurred in mscorlib.dll but was not handled in user code
Exception was thrown at line 4224, column 4 in http://localhost:49185/YotaCast_Prototype/Scripts/jquery-1.9.1.js
0x800a139e - JavaScript runtime error: SyntaxError
Exception was thrown at line 4242, column 4 in http://localhost:49185/YotaCast_Prototype/Scripts/jquery-1.9.1.js
0x800a139e - JavaScript runtime error: SyntaxError
Exception was thrown at line 360, column 9 in http://localhost:49185/YotaCast_Prototype/Scripts/foundation/foundation.js
0x800a1391 - JavaScript runtime error: 'Zepto' is undefined
Exception was thrown at line 1, column 97 in http://s.ytimg.com/yts/jsbin/www-embed-player-vflXN6WzI.js
0x80070005 - JavaScript runtime error: Access is denied.