python-2.7 - 无法为Youtube Analytics API配置OAuth2:

标签 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 Cloud Console上的应用程序使用以下重定向uri和javascript来源进行设置:
**Redirect URIs     
[http://localhost:8080/oauth2callback]
Javascript Origins  
[http://localhost:8080]**

我的client_secrets.json文件的内容(在第24行传递给程序)如下所示:
{"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。解决这个问题的任何帮助将不胜感激,因为我不知道它为什么会发生。

最佳答案

重定向_uris必须与开发者控制台的apps项目中设置的_uris相同。

关于python-2.7 - 无法为Youtube Analytics API配置OAuth2:,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22109239/

相关文章:

javascript - Google 跟踪代码管理器 gtm.click {{Click Text}}

google-analytics - 为什么 "experiment"菜单项在 Google Analytics 的 "content"部分中不可见?

python-2.7 - requests.delete 在 Artifactory 上引发 GET 而不是 DELETE

python - 正则表达式提取字符串中的第一组数字及其后的所有单词

php - 使用Codeigniter将视频远程上传到youtube

promise - 未处理的 promise 拒绝:错误:当我在JavaFX上的WebView中加载Youtube视频时,URL不可信

python - 调用 if __name__ == '__main__' : in one module from a function in another module

python - 使用 Python 查找稀有字符

javascript - GreaseMonkey + YouTube + .click()

用于谷歌分析的 Java API