1

我正在尝试将“Google Identity Toolkit”与“教程”android 演示应用程序一起使用,但现在我收到此错误:

{
  "error": {
    "errors": [
      {
        "domain": "usageLimits",
        "reason": "ipRefererBlocked",
        "message": "There is a per-IP or per-Referer restriction configured on your API key and the request does not match these restrictions. Please use the Google Developers Console to update your API key configuration if request from this IP or referer should be allowed.",
        "extendedHelp": "https://console.developers.google.com"
      }
    ],
    "code": 403,
    "message": "There is a per-IP or per-Referer restriction configured on your API key and the request does not match these restrictions. Please use the Google Developers Console to update your API key configuration if request from this IP or referer should be allowed."
  }
}

任何想法?在 Google 控制台中,我需要允许一些事情吗?在哪里?

OAuth 2.0 客户端 ID:

安卓,
网络应用

在 Identity Toolkit API 控制台上,它允许我在 Google 提供商中选择“Web 应用程序”客户端 ID。

我已经在我的“教程”应用程序中设置了这个

4

3 回答 3

1

当您尝试在未添加到控制台中的引荐来源网址的 URL 上运行代码时,通常会导致此错误。

要解决此问题,请转到 Google Developer Console,然后在 API Manager 下单击凭据并找到您的浏览器密钥。在此页面上,您可以添加将使用该密钥的任何 URL。记住它对待 www。不同,因此要覆盖所有可能的页面,您可以这样做: .domain.com/ domain.com /*

于 2015-11-23T10:57:55.867 回答
0

您将需要...

  1. 创建 Android API 密钥
  2. 设置签名密钥文件的包名称和 SHA-1(请参阅 gitkit 指南了解如何操作)
  3. 使用该 API 密钥作为identitytoolkit.api_key
于 2016-02-09T03:40:40.393 回答
0

我今天发现创建新的 Android API 密钥时存在错误。您可能已经注意到,当您创建 Android API 密钥时,还会生成一个浏览器 API 密钥。我的浏览器 API 密钥没有名称,因此不可配置。但是,我执行了一些 URL 操作魔术,以便能够访问和编辑我的浏览器 API 密钥。这是我所做的:

1) 点击Android API key的名字

2) 在 ? 之前编辑 URL 这样前面的数字?匹配浏览器 API 密钥位置的(从 0 开始的)索引。也就是说,如果您的浏览器 api 密钥出现在您的两个 API 密钥列表中的第二位,那么您的 Android API 密钥将排在第一位,位于位置 0。因此 URL 将如下所示:

.../key/0?...

所以现在你想把它改成这样:

.../key/1?...

3)从这里您应该能够将您允许的推荐人更改为

http://yourdomain.com/*

然后,只要您正确设置了密钥,一切都应该按预期工作!另外,请注意,执行此操作后,您将获得浏览器密钥的名称,并且将来可以轻松编辑!

祝你好运!

于 2015-12-17T04:07:27.333 回答