【发布时间】:2014-05-28 08:36:51
【问题描述】:
您好,希望有人能帮帮我。
我的本地计算机上有一个 Web 应用程序 (asp.net),我正在尝试使用此示例将视频上传到 YouTube https://developers.google.com/youtube/v3/code_samples/dotnet#upload_a_video
当我尝试上传视频时,我已经在 Google 控制台中为 Web 应用程序设置了客户端 ID 和密码,浏览器选项卡打开以选择我的一个谷歌帐户,一旦我登录,我得到 redirect_uri_mismatch 该页面上的响应详细信息如下:
cookie_policy_enforce=false
scope=https://www.googleapis.com/auth/youtube.upload
response_type=code
access_type=offline
redirect_uri=http://localhost:55556/authorize/
pageId=[some page id removed here for security reasons]
display=page
client_id=[some unique id removed here for security reasons].apps.googleusercontent.com
一件有趣的事情是redirect_uri=http://localhost:55556/authorize/ 与谷歌控制台中设置的完全不同,而client_secrets.json 中的设置也完全不同,每次我收到错误页面时端口号都会更改。
reduce url 和 origins 在 Google 控制台中设置如下我想我已经添加了所有组合以防万一:
授权重定向 URI
http://localhost/
https://localhost/
http://localhost:50169/AddContent.aspx
https://localhost:50169/AddContent.aspx
http://localhost:50169
授权的 JavaScript 来源
http://localhost/
https://localhost/
http://localhost:50169/
https://localhost:50169/
我不确定为什么错误页面上的 redirect-uri 与任何 我在 Google 控制台中指定的授权重定向 URI?有什么想法吗?
还有可能在 Google 控制台和我的代码中所有设置都正确,但是这个错误是由其他东西触发的,比如我可能错过了我的油管帐户上的一些设置?我没有进行任何设置更改,因为我认为我不必这样做是正确的吗?
【问题讨论】:
-
你搞定了吗?
-
不,Google/YT 已经改变了他们的库,你不能再这样做了,但是现在已经几个月了,我已经把这个功能留在了我的项目中并专注于其他人。我认为您可以改用不同的免费视频共享选项。我还注意到一些网站曾经使用 YT 进行视频共享,现在他们使用其他一些第三方,所以不确定。但请告诉我你的情况。
标签: c# youtube oauth-2.0 google-api