2014-03-01 121 views
0

我试图通过python使用Youtube Analytics API。我从Google开发人员网站下载了示例python代码。这里是链接:为Youtube Analytics API配置OAuth2有困难:

https://developers.google.com/youtube/analytics/v1/code_samples/python

每当我运行它,我的浏览器打开了以下错误消息的页面:

**Error: redirect_uri_mismatch The redirect URI in the request: [http://localhost:8080/] did not match a registered redirect URI** 

我在谷歌云端控制台应用程序设置与以下重定向URI和JavaScript来源:

**Redirect URIs  
[http://localhost:8080/oauth2callback] 
Javascript Origins 
[http://localhost:8080]** 

我client_secrets.json档案,我传递给程序的第24行的内容,看起来为f ollows:

{"web":{"auth_uri":"[https://accounts.google.com/o/oauth2]/auth","client_secret":"KNLERUsUrOsOiJTzyaSWN2JG","token_uri":"[https://accounts.google.com/o/oauth2/token]","client_email":"[email protected]account.com","redirect_uris":["[http://localhost:8080/oauth2callback]"],"client_x509_cert_url":"[https://www.googleapis.com/robot/v1/metadata/x509/[email protected]account.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。任何帮助解决这个问题将不胜感激,因为我在为什么它发生的损失。

回答

0

重定向_uris需要与您在开发人员控制台中的应用程序项目中设置的相同。

+0

DalmTo,感谢您的回复;不过,我已经将redirect_uris设置为与我为授权提供的相同。你可以看到我的json文件中的地址匹配。实际上,这个JSON文件是基于我设置的redirect_uris在谷歌云控制台上生成的。 – user3366986