2014-11-13 55 views
0

我想在https://developers.google.com/console/help/new/#generatingdevkeysGoogle API密鑰是否適用於Prediction API?

使用下列指令的服務器API密鑰我已經生成的密鑰和白名單我的IP地址(到目前爲止,從兩個不同的人嘗試過)。

但是,我發送的每個響應都會導致401未經授權。我的HTTP請求是這樣的:

從IP請求與關鍵

POST https://www.googleapis.com/prediction/v1.6/projects/652546152834/hostedmodels/website/predict?key={MY_API_KEY_IS_HERE} HTTP/1.1 
User-Agent: Fiddler 
Host: www.googleapis.com 
Content-Length: 0 

響應

{ 
"error": { 
    "errors": [ 
    { 
    "domain": "global", 
    "reason": "required", 
    "message": "Login Required", 
    "locationType": "header", 
    "location": "Authorization" 
    } 
    ], 
    "code": 401, 
    "message": "Login Required" 
} 
} 

我缺少一個步驟有關?我不想使用OAuth,因爲它對於我的簡單場景似乎有點過分,但如果這裏沒有解決方案,我會接下來做。

回答

1

您的應用程序必須使用OAuth 2.0來授權請求​​。沒有其他授權協議被支持。

Source

+0

很好,謝謝!我太專注於一般API授權文檔,完全錯過了。 –