Do Google API keys work for Prediction API?

508 views Asked by At

I am trying to use a Server API Key following the instructions at https://developers.google.com/console/help/new/#generatingdevkeys

I have generated a key and whitelisted my IPs (tried from two different ones so far).

However, every response I send results in 401 Unauthorized. My HTTP request looks like this:

Request from an IP associated with the key

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

Response

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

Am I missing a step? I'd prefer not to use OAuth since it seems like overkill for my simple scenario, but I'll do that next if there's no solution here.

1

There are 1 answers

1
abraham On BEST ANSWER

Your application must use OAuth 2.0 to authorize requests. No other authorization protocols are supported.

Source