本文介绍了不断收到错误:redirect_uri_mismatch 使用 youtube api v3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望有人能在这里帮助我.

Hi I hope someone can help me out here.

我的本​​地机器上有一个 Web 应用程序 (asp.net),我正在尝试使用此示例将视频上传到 YouTube https://developers.google.com/youtube/v3/code_samples/dotnet#upload_a_video

I have a Web Application (asp.net) on my local machine, I am trying to upload video to YouTube using this sample https://developers.google.com/youtube/v3/code_samples/dotnet#upload_a_video

当我尝试上传视频时,我已经在 Google 控制台中为 Web 应用程序设置了客户端 ID 和密码,打开浏览器选项卡以选择我的 Google 帐户之一,一旦我登录,我就会收到 redirect_uri_mismatch,该页面上的响应详细信息如下:

I have set up client id and secret for Web application in Google console when I try to upload video a browser tab opens to select one of my google accounts and once I sig in I get redirect_uri_mismatch the response details on that page are below:

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/ 与 Google 控制台中设置的完全不同,并且每次我在 client_secrets.json 中设置的都完全不同获取端口号更改的错误页面.

one interesting thing is that the redirect_uri=http://localhost:55556/authorize/ is completely different from the one set up in Google console and the one in client_secrets.json also each time I get the error page the port number changes.

reducect urls 和 origins 在 Google 控制台中设置如下我想我已经添加了所有组合以防万一:

redurect urls and origins are set as follows in Google console I think I have added all combinations just in case:

授权的重定向 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/

我不确定为什么错误页面上的重定向 uri 与任何我在 Google 控制台中指定的授权重定向 URI ?有什么想法吗?

I am not sure why redirect-uri on the error page does not match any of the Authorized redirect URI I have specified in Google console ? any ideas ?

还有可能一切都在 Google 控制台和我的代码中正确设置,但这个错误是由其他原因触发的,比如我可能错过了我的 YouTube 帐户上的某些设置?我没有进行任何设置更改,因为我认为我不必这样做是正确的吗?

Also is it possible that everything is set-up correctly in Google console and my code but this error is triggered by something else like maybe I missed some setting on my you tube account ? I did not make any setting changes since I don't think I have to is that correct ?

推荐答案

好吧,我相信根据这些帖子,YT API v3.0 不再支持将视频直接上传到网站所有者帐户.

Ok I belive that direct video upload to the website owner account is no longer supported in YT API v3.0 according to those posts.

可以直接使用 YouTube上传到所有用户的通用帐户?

如何使用 API 将 youtube 网络摄像头小部件上传到一个帐户?

不好意思,我想我需要在我的服务器上托管用户上传的视频.

Shame, I think I will need to host the videos that users upload on my servers.

但是,通过将此 URI 添加到开发者控制台中的重定向 URI 来修复了原始问题

http://localhost/authorize/

Google OAuth 2 授权 - 错误:redirect_uri_mismatch

这篇关于不断收到错误:redirect_uri_mismatch 使用 youtube api v3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 03:44