运行 Google“Hello Analytics"时如何避免此 X-Frame-Options SAMEORIGIN 错误?API教程? [英] How do I avoid this X-Frame-Options SAMEORIGIN error when running the Google "Hello Analytics" API tutorial?

查看:45
本文介绍了运行 Google“Hello Analytics"时如何避免此 X-Frame-Options SAMEORIGIN 错误?API教程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试运行 https://developers.google.com/analytics/solutions/articles/hello-analytics-api 教程,以通过编程方式从 Google Analytics 中提取数据来启动和运行.

I've been trying to run the https://developers.google.com/analytics/solutions/articles/hello-analytics-api tutorial to get up and running with pulling data programmatically from Google Analytics.

我已经完全复制了示例文件,但是当我通过 Chrome 中的 localhost 访问它们时,我在 JavaScript 控制台中收到以下错误,并被重定向到 about:blank :

I've copied the sample files exactly, but when I access them via localhost in Chrome, I get the following error in the JavaScript console, and get redirected to about:blank :

Refused to display 'https://accounts.google.com/o/oauth2/auth?client_id=363192057646-fbj7q1oais...%2Flocalhost&response_type=token&state=327475409%7C0.2024869166&authuser=0' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'.

我尝试了各种调整,但无法消除此错误.希望有人可以提供帮助(或者实际上只是将我引向一个简单、有效的 Javascript 示例,用于访问 Google Analytics API.

I've tried all manner of tweaks but can't get this error to go away. Hope someone can assist (or indeed just direct me to a simple, working, Javascript example for accessing the Google Analytics API.

推荐答案

请检查 Authorized JavaScript originsurl 在您的 Oauth 设置中的 Google API 控制台中.这必须是您授权 javascript 的地方.

Please check the Authorized JavaScript origins url in the Google API console in your Oauth Settings. This must be where you are authorising the javascript.

这篇关于运行 Google“Hello Analytics"时如何避免此 X-Frame-Options SAMEORIGIN 错误?API教程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆