我正试图从Android应用程序中访问谷歌的翻译服务。但是,每次尝试访问服务(使用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开发者的控制台上,创建了一个新项目。
2。在左侧的“api和auth”部分中,激活了translate api v2。
三。使用debug.keystore生成sha1密钥,并在开发人员控制台上使用此信息生成新密钥。
4。添加了帐单信息。信用卡已被接受。
5。使用以下链接访问Translate API:
https://www.googleapis.com/language/translate/v2?key=myKey&source=en&target=hi&q=hell
每次应用程序运行上述get请求时,都会返回403错误。我已经浏览了所有的链接,所以或谷歌可以关心抛出这个问题,似乎没有任何影响。
你知道我哪里会出错吗?
最佳答案
因为你用android应用程序(包名和sha证书)限制了api密钥,所以你必须在发送给google的每个请求的头中包含这些信息。
Read more here