2015-09-16 34 views
8

我正在制作网站使用谷歌翻译API。 我已经安装浏览器的API密钥 但问题是,如果我离开空场接受来自这些HTTP参照(网站)请求该浏览器的API密钥才起作用。浏览器API密钥不适用于引用者

如果我把有*.mydomain.com/* 我收到提示:

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. 

什么,我做错了吗?

回答

13

为了保持注意,我今天有这个错误,它发生是因为键类型。您需要使用Server Key而不是Browser Key

要创建一个,请转到Google控制台(https://console.developers.google.com/)和API管理器>凭证。

+0

谢谢,你的回答解决了我的问题.. :) – Sonia

9

转到https://console.developers.google.com,在凭证标签中,编辑您正在使用的API密钥,并将API限制从“浏览器”更改为“无”或“服务器”。 注意:如果您正在使用服务器限制,则需要添加正确的服务器路径。

https://i.stack.imgur.com/CzhUn.png

相关问题