PermissionDenied:资源项目 XXXXXXX 的 403 权限被拒绝

PermissionDenied: 403 Permission denied on resource project XXXXXXX

提问人:Akshay Malik 提问时间:11/3/2023 更新时间:11/3/2023 访问量:24421

问:

我正在尝试使用 Google 的文档 AI 处理文档。但是我面临着一些问题。我已经创建了服务帐户,获得了所有必要的访问权限,但仍然无法处理文档。以下是我的服务帐号拥有的访问权限: 文档 AI 管理员 文档 AI API 用户 文档 AI 编辑器 存储管理员

以下是我在 jupyter 笔记本上遇到的错误。我正在使用谷歌文档中的代码来处理文档。

`_InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
    status = StatusCode.PERMISSION_DENIED
    details = "Permission denied on resource project XXXXXXXX."
    debug_error_string = "UNKNOWN:Error received from peer ipv6:XXXXXXX {created_time:"2023-11-02T01:26:08.259379+05:30", grpc_status:7, grpc_message:"Permission denied on resource project XXXXXXXX."}"
>

The above exception was the direct cause of the following exception:`

`PermissionDenied: 403 Permission denied on resource project XXXXXXXX. [links {
    description: "Google developer console API key"
    url: "https://console.developers.google.com/project/XXXXXXX/apiui/credential"
}, 
reason: "CONSUMER_INVALID"
domain: "googleapis.com"
metadata {
    key: "service"
    value: "documentai.googleapis.com"
}
metadata {
    key: "consumer"
    value: "projects/XXXXXXXX"
}`
google-cloud-platform 人工智能 文档 cloud-document-ai

评论


答:

0赞 Holt Skinner 11/3/2023 #1

您是否下载了服务帐户密钥并在您的环境中使用该密钥?

我建议按照快速入门:从环境身份验证步骤开始设置 Document AI API 中列出的步骤进行操作。

如果您使用的是 Colab,则可以通过运行以下代码来基于您的用户帐户进行身份验证:

from google.colab import auth
auth.authenticate_user()