Reputation: 2287
I was trying to run the sample app, found here Github Sample, I have created a certificate and created a API Key and applied as instructed. But when I upload the Image I am getting this Exception. I dont know where I have made a mistake. Have I missed anything?
failed to make API request because {
"code": 403,
"errors": [{
"domain": "global",
"message": "Requests from this Android client application <empty> are blocked.",
"reason": "forbidden"
}],
"message": "Requests from this Android client application <empty> are blocked.",
"status": "PERMISSION_DENIED"
}
Upvotes: 12
Views: 7476
Reputation: 628
You may have also limited your API Key to only allow requests from Android apps. Changing it to None
, it will accept all requests, however, this also means less security.
Upvotes: 0
Reputation: 2502
I believe using the browser key would solve your problem. But the actual solution to this is using an OAuth Key. Like an Android App should do.
This is an excerpt form the full tutorial here.
Upvotes: 0
Reputation: 327
some problem here, and i fix it!!!!!
just put Server Key!!
hope its help someone
Upvotes: 0
Reputation: 1506
I suspect that you are creating an Android API key, restricted to your app, with your sha1 fingerprint registered.
This is great! Unfortunately, the non-android-specific Google API java client library doesn't yet fully support API requests for android api keys, like the android-specific one does. This means that API requests aren't including some headers that authenticate the key/app to the API endpoint, which causes that error (note the client application <empty>
in the error message - the <empty>
would be your package name, if the request was formed as expected).
I'm still looking for what to do about that - will update if / when I find one.
Upvotes: 9
Reputation: 74
I had the same problem. but I solve this.
If you add Browser API Key, your code works well.
Upvotes: 5
Reputation: 287
What all did you change in the android project? Make sure that you enable the cloud vision API and enable billing. All I had to do was add my API key in the MainActivity using the same sample from Github.
Take a look at my screenshot
Upvotes: 0