Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Cloud Vision API Permission Denied

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"
}
like image 425
Amalan Dhananjayan Avatar asked Feb 21 '16 03:02

Amalan Dhananjayan


People also ask

What is GCP vision API?

Overview. The Google Cloud Vision API allows developers to easily integrate vision detection features within applications, including image labeling, face and landmark detection, optical character recognition (OCR), and tagging of explicit content. In this codelab you will focus on using the Vision API with Python.


1 Answers

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.

like image 183
jerjou Avatar answered Sep 17 '22 21:09

jerjou