【问题标题】:Error 403 with Google Translate v2 API access访问 Google Translate v2 API 时出现错误 403
【发布时间】:2014-01-31 06:34:55
【问题描述】:

我正在尝试从 Android 应用中访问 Google 的翻译服务。但是,每次我尝试访问服务(使用HttpGet 请求)时,都会遇到以下错误:

{
 "error": {
  "errors": [
   {
    "domain": "usageLimits",
    "reason": "accessNotConfigured",
    "message": "Access Not Configured. Please use Google Developers Console to activate the API for your project."
   }
  ],
  "code": 403,
  "message": "Access Not Configured. Please use Google Developers Console to activate the API for your project."
 }
}  

我无法解决上述错误。我已将项目设置如下:
1. 在 Google Developer's Console 上,创建一个新项目。
2. 从左侧的“APIs and Auth”部分,激活 Translate API v2。
3. 使用 debug.keystore 生成 SHA1 密钥,并在开发者控制台上使用此信息生成新密钥。
4. 增加计费信息。信用卡已被接受。
5. 使用以下链接访问翻译API:
https://www.googleapis.com/language/translate/v2?key=myKey&source=en&target=hi&q=hell

应用每次运行上述Get Request,都会返回403错误。我已经浏览了 SO 或 Google 在这个问题上可能会提出的所有链接,但似乎没有任何影响。

有什么想法我可能会出错吗?

【问题讨论】:

  • 不确定,但debug.keystore 可能是错误的。您通常希望使用发布密钥进行设置,因为这是您发布的应用程序用来进行身份验证的密钥。
  • @Sriram 你能解决这个问题吗?
  • @AhmedZ.:不。不走运。
  • @Sriram Ohhhh 非常大...

标签: android api google-translate


【解决方案1】:

由于您使用您的 android 应用程序(包名称和 SHA 证书)限制了您的 api 密钥,因此您必须将这些信息包含在发送给 google 的每个请求的标头中。

Read more here.

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-02-27
    • 2017-05-12
    • 1970-01-01
    • 2015-01-09
    • 1970-01-01
    • 1970-01-01
    • 2023-03-30
    • 1970-01-01
    相关资源
    最近更新 更多