Google Cloud Vision API:“请求的身份验证范围不足." [英] Google Cloud vision API: "Request had insufficient authentication scopes."

查看:38
本文介绍了Google Cloud Vision API:“请求的身份验证范围不足."的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用谷歌的云视觉 API,特别是这个例子:https://cloud.google.com/vision/docs/label-tutorial#label_tutorial_1

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

我遵循了本教程:https://cloud.google.com/vision/docs/getting-started#set_up_a_service_account 用于设置服务帐户,但是当我运行我的代码时,我得到:

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.">

有人可以帮忙吗?我不知道发生了什么,我的代码与教程是 1:1 的.

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

推荐答案

您需要从计算机中清除 ~/.credentials/sheets.googleapis.com-python-quickstart.json.然后将您的范围定义为 https://www.googleapis.com/auth/drive.再次运行您的代码,它应该要求您重新授权.然后运行你的代码.

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.

这篇关于Google Cloud Vision API:“请求的身份验证范围不足."的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆