gpt4 book ai didi

android - 谷歌翻译 v2 API 访问错误 403

转载 作者:太空宇宙 更新时间:2023-11-03 11:13:28 24 4
gpt4 key购买 nike

我正在尝试从 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 key ,并在开发者控制台上使用此信息生成新 key 。
4.增加了账单信息。已接受信用卡。
5. 使用以下链接访问 Translate API:
https://www.googleapis.com/language/translate/v2?key=myKey&source=en&target=hi&q=hell

app每次运行上面的Get Request,都会返回403错误。我已经浏览了 SO 或 Google 可以关心的所有链接,但似乎没有任何影响。

我有什么地方可能出错的想法吗?

最佳答案

因为您使用您的 Android 应用程序(程序包名称和 SHA 证书)限制了您的 API key ,所以您必须将这些信息包含在每个发送给 Google 的请求的 header 中。

Read more here .

关于android - 谷歌翻译 v2 API 访问错误 403,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21075625/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com