Python 2.7 为Youtube分析API配置OAuth2的困难:

Python 2.7 为Youtube分析API配置OAuth2的困难:,python-2.7,youtube,google-analytics,Python 2.7,Youtube,Google Analytics,我正试图通过python使用Youtube分析API。我从Google开发者网站下载了python示例代码。以下是链接: 无论何时运行,我的浏览器都会打开一个包含以下错误消息的页面: **Error: redirect_uri_mismatch The redirect URI in the request: [http://localhost:8080/] did not match a registered redirect URI** 我在Google云控制台上的应用程序使用以下重定向u

我正试图通过python使用Youtube分析API。我从Google开发者网站下载了python示例代码。以下是链接:

无论何时运行,我的浏览器都会打开一个包含以下错误消息的页面:

**Error: redirect_uri_mismatch The redirect URI in the request: [http://localhost:8080/] did not match a registered redirect URI**
我在Google云控制台上的应用程序使用以下重定向uri和javascript源代码进行设置:

**Redirect URIs     
[http://localhost:8080/oauth2callback]
Javascript Origins  
[http://localhost:8080]**
我在第24行将client_secrets.json文件的内容传递给程序,如下所示:

{"web":{"auth_uri":"[https://accounts.google.com/o/oauth2]/auth","client_secret":"KNLERUsUrOsOiJTzyaSWN2JG","token_uri":"[https://accounts.google.com/o/oauth2/token]","client_email":"409435120404-k62menuelac66nbl9ic82uqakbd4nhrh@developer.gserviceaccount.com","redirect_uris":["[http://localhost:8080/oauth2callback]"],"client_x509_cert_url":"[https://www.googleapis.com/robot/v1/metadata/x509/409435120404-k62menuelac66nbl9ic82uqakbd4nhrh@developer.gserviceaccount.com]","client_id":"409435120404-k62menuelac66nbl9ic82uqakbd4nhrh.apps.googleusercontent.com","auth_provider_x509_cert_url":"[https://www.googleapis.com/oauth2/v1/certs]","javascript_origins":["[http://localhost:8080]"]}}

我正在运行Ubuntu 13.10。如果您能帮助解决此问题,我将不胜感激,因为我不知道为什么会发生此问题。

重定向\u URI需要与您在开发者控制台的应用程序项目中设置的URI相同。

DalmTo,感谢您的回复;但是,我已经将重定向URI设置为与我提供的授权相同。您可以看到我的json文件中的地址匹配。事实上,该JSON文件是由google云控制台基于我设置的重定向URI生成的。