C# 中的 YouTube 数据 Api v3 [英] YouTube Data Api v3 in C#

查看:54
本文介绍了C# 中的 YouTube 数据 Api v3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习在 C# 中使用 YouTube Data Api v3.我想做的是管理 YouTube 播放列表(创建、删除、更新).我希望它是一个控制台项目.我使用了此处的示例播放列表代码.我已经使用了创建播放列表代码,但是当我运行它时,它显示了以下内容错误:

I am learning to use YouTube Data Api v3 in C#. What I want to do is to manage YouTube Playlists (Create, Delete, Update). I want it to be a console project. I used the sample playlist code given here. I've used the Create Playlist Code but when I run it it shows me the following Error:

请求中的重定向 URI 127.0.0.1:52222/authorize/没有匹配为 OAuth 客户端授权的那些.要更新授权的重定向 URI,请访问:<...>

The redirect URI in the request, 127.0.0.1:52222/authorize/, does not match the ones authorized for the OAuth client. To update the authorized redirect URIs, visit: <...>

该项目处于初始阶段.任何人都可以指导我吗?我不知道是什么问题.

The project is in initial faces. Can anyone guide me? I don't know what is the problem.

推荐答案

在从 Youtube API 文档,了解如何处理 API 身份验证和授权的基础知识很重要.所有 API 调用都必须使用简单或授权访问(定义如下).许多 API 方法需要授权访问,但有些方法可以使用两者之一.一些可以使用两者之一的 API 方法的行为会有所不同,具体取决于您是使用简单访问还是授权访问.

Before you copy the code from the Youtube API documentation, it is important to understand the basics of how API authentication and authorization are handled. All API calls must use either simple or authorized access (defined below). Many API methods require authorized access, but some can use either. Some API methods that can use either behave differently, depending on whether you use simple or authorized access.

从您的 Google API 控制台,您必须设置您的授权 Javascript 来源授权的重定向 URI.当 Google 的服务器获得用户的授权后,它会将浏览器重定向到您作为 redirect_uri 发送的任何内容.重定向 URI 位于 client_secrets.json 文件中,该文件可以验证 OAuth 流程并指定您的应用允许的匹配.

From your Google API Console, you must set your Authorized Javascript Origins and Authorized redirect URIs. When Google's server gets authorization from the user, then it will redirect the browser to whatever you sent in as the redirect_uri. The redirect URIs are in the client_secrets.json file that can verify the flow of OAuth and will specify the match that your app allows.

有关详细信息,您可以访问入门文档使用 .Net.

For more info, you can visit the Get Start documentation using .Net.

这篇关于C# 中的 YouTube 数据 Api v3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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