【问题标题】:Error: origin_mismatch when authorizing embed API for Google Analytics错误:授权 embed API for Google Analytics 时的 origin_mismatch
【发布时间】:2015-06-24 11:41:20
【问题描述】:

我正在尝试在第 3 方 CMS 中实施来自谷歌分析的统计信息仪表板,但遇到了一些问题。我正在尝试使用 googles embed API 来构建我的仪表板并在尝试验证我的帐户时遇到此错误:

Error: origin_mismatch 

我四处寻找解决方案,很快发现这是因为缺少www.。问题是我在谷歌开发者控制台中填写了正确的 URL,但仍然没有运气。有谁知道我该如何解决这个问题才能正常工作?

Error: origin_mismatch

Application: CMEZ Analytics

You can email the developer of this application at: email@email.com

Request Details
=
from_login=1
response_type=code token id_token gsession
scope=https://www.googleapis.com/auth/analytics.readonly https://www.googleapis.com/auth/userinfo.email
redirect_uri=postmessage
cookie_policy=single_host_origin
proxy=oauth2relay482041337
include_granted_scopes=true
origin=http://cmez.eu
state=458516662|0.59538506
as=1d7def2550073266
client_id=[censored]
authuser=1
hl=nl
That’s all we know.

【问题讨论】:

  • 所以请求详细信息显示“cmez.eu”的来源。这是否在 API 控制台中列为您应用的允许来源之一?

标签: javascript google-api google-oauth google-analytics-api


【解决方案1】:

origin_mismatch 错误可能是由于在您的项目的Google Developer console 中未正确设置 Javascript 源。 Javascript 来源必须与您的请求来自的域以及您在登录后将用户返回到的域相匹配。

注意:这里的一个常见错误是为 http:// 添加 javascript 来源,而不是 https://(反之亦然)。如果 url 中出现端口号,您还必须在 javascript 源中包含服务器的端口号。

Documentation info

在授权的 JavaScript 来源字段中,输入您的来源 应用程序。您可以输入多个来源以允许您的应用程序在其上运行 不同的协议、域或子域。通配符不是 允许。在下面的示例中,第二个 URL 可能是一个产品 网址。 http://localhost:4567
https://myproductionurl.example.com

【讨论】:

    猜你喜欢
    • 2016-01-23
    • 2016-06-14
    • 2015-10-20
    • 2018-03-16
    • 2017-01-08
    • 1970-01-01
    • 2013-07-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多