Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Cloud vision API: "Request had insufficient authentication scopes."

Hi I'm trying to use google's cloud vision API, specifically this example: https://cloud.google.com/vision/docs/label-tutorial#label_tutorial_1

I followed this tutorial: https://cloud.google.com/vision/docs/getting-started#set_up_a_service_account for setting up a service account but when I run my code I get:

googleapiclient.errors.HttpError: <HttpError 403 when requesting https://vision.googleapis.com/$discovery/rest?version=v1 returned "Request had insufficient authentication scopes.">

Can anybody help? I can't figure out what's going on, my code is 1:1 with the tutorials.

like image 935
Rali Tsanova Avatar asked Mar 07 '16 14:03

Rali Tsanova


People also ask

What does request had insufficient authentication scopes mean?

"Request had insufficient authentication scopes." This error will occur if you miss an important step during the login process. To fix, login to YouTube again via vMix. But when you reach the below step make sure you tick the last checkbox for "Manage your YouTube Account".

How do I get my Google Vision API key?

You need to create a project in the Google cloud, give it a credit card number, enable the GCV API, and then get an API key. You won't be charged anything unless you make 1000 API calls in a month; but then you start paying, so be careful!


2 Answers

You need to clean ~/.credentials/sheets.googleapis.com-python-quickstart.json from your computer. Then define your scope as https://www.googleapis.com/auth/drive. Run your code again, it should ask you to re-authorize. Then run your code.

like image 192
agondiken Avatar answered Nov 06 '22 20:11

agondiken


I was getting the same error. I did the following:

sudo apt-get update & apt-get upgrade

pip install --upgrade google-api-python-client

then initialized the gcloud sdk via ...

gcloud init 

and voila it started working!

You can also try re-generating the credentials from the API manager

like image 25
Aakash Gupta Avatar answered Nov 06 '22 19:11

Aakash Gupta