【问题标题】:Google Analytics Reports Embed API returns 403 errorGoogle Analytics Reports Embed API 返回 403 错误
【发布时间】:2018-03-16 00:59:33
【问题描述】:

我刚从“https://developers.google.com/analytics/devguides/reporting/embed/v1/getting-started”开始了解 Google Analytics Embed API

我按照他们的示例,将我的 HTML 文件部署到托管在端口 8080 的本地 Tomcat 服务器上。我已经添加了他们提到的所有内容,包括主机来源的白名单等,提供我的 OAuth 2.0 密钥

当我点击我的 HTML 页面并使用 google 登录时,我在请求“https://content.googleapis.com/analytics/v3/management/accountSummaries?max-results=0&_src=embed-api%3Av1”时不断收到 403 错误

有人对我可能出错的地方有任何建议吗?

附言使用 Google 登录后,我在页面上看到的唯一内容是“您登录为:***********@gmail.com”

谢谢,

【问题讨论】:

    标签: api google-analytics report embed google-reporting-api


    【解决方案1】:

    查看您的链接后,我可以看到错误代码是 401。关于该错误,您可以查看此SO thread

    我认为您需要按照回答中的建议设置service account

    通过在Google apis console 中设置服务帐户,它将 允许您访问自己的数据而无需登录和 始终对代码进行身份验证。

    【讨论】:

      猜你喜欢
      • 2012-01-17
      • 1970-01-01
      • 1970-01-01
      • 2015-08-12
      • 1970-01-01
      • 1970-01-01
      • 2015-07-31
      • 2014-01-24
      • 2021-07-11
      相关资源
      最近更新 更多