难以为Youtube Analytics API配置OAuth2:

时间:2014-03-01 02:12:59

标签: python-2.7 youtube google-analytics

我正在尝试通过python使用Youtube Analytics API。我从Google开发者网站下载了示例python代码。这是链接:

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**

我在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。任何帮助解决这个问题的人都会非常感激,因为我不知道为什么会这样做。

1 个答案:

答案 0 :(得分:0)

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