问题描述
我在使用Google翻译时遇到了Google控制台API的问题。
当我从本地机器运行测试时,它运行良好,但是当我尝试在远程测试虚拟服务器上运行它时,它会返回上面的403.
我在控制台API访问中使用服务器密钥进行简单API访问,并将我的密钥配置为本地和测试机器IP地址。
debug:
lynx --dumpcheckip.dyndns.org;
- IP与我在API API控制台中设置的API匹配
curl -vhttps://www.googleapis.com/language/translate/v2?q=hello&target=de&source=en& key = MYAPIKEY
{
error:{
errors:[
{
domain:usageLimits,
reason:accessNotConfigured,
message:Access Not Configured
}
],
code:403,
message :Access Not Configured
}
}
像我说的,我的本地机器也是如此。在Google API控制台中为两个IP配置API密钥
更新:当我使用连接到url引用来源而不是IP的浏览器密钥时,它可以正常工作。
所以问题需要以某种方式在IP,但我不能得到的地方。
任何whatsmyip服务都可以确认我的IP匹配。
我有同样的问题,事实证明,我并未在。也许你遇到了同样的问题,但'translate api'没有被启用
i have problem with Google console API while using Google translate trough it.When i run the test from my local machine, it works great, but when i try to run it at my remote test virtual server it return that 403 above.
I am using Simple API access by Server key in console API access and my key is configured to both local and test machine IP addresses.
debug:
lynx --dump "checkip.dyndns.org";
- IP match with the one in my API key setup in google API console
curl -v "https://www.googleapis.com/language/translate/v2?q=hello&target=de&source=en&key=MYAPIKEY"
{
"error": {
"errors": [
{
"domain": "usageLimits",
"reason": "accessNotConfigured",
"message": "Access Not Configured"
}
],
"code": 403,
"message": "Access Not Configured"
}
}
Like i said, the same works at my local machine. API key is configured for both IPs in Google API console
UPDATE: when i used "Browser key" attached to url referrer instead of IP, it works.So the problem needs to be somehow in IP, but i cant get where.Any "whatsmyip" service confirms my IPs match.
i had the same problem but with the tasks api, turns out i hadn't enabled the 'task api' under the services tab at https://code.google.com/apis/console. Maybe you're having the same problem but with the 'translate api' not being enabled
这篇关于谷歌翻译API v2 - (403)访问未配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!