2015-09-16 43 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

相關問題