使用 Google Document AI(表单解析器 API)进行身份验证

发布于 2025-01-20 05:01:03 字数 1641 浏览 5 评论 0原文

我一直在尝试从解析器 API 进行身份验证,但没有成功。 我已经设置了 google 服务帐户并创建了两个密钥。我已经设置了所有者角色并下载了凭证 json 文件。

googleAuthR::gar_auth_service("D:/898 sample/document ai/form-898-scan-bd4b8b48b570.json")
library(daiR)

response1 <- dai_sync("D:/test file.pdf"
                      ,
                      proj_id = get_project_id(path = "D:/crudentialabc123.json"),
                      proc_id = "e4xxxxxx",
                      loc = "us",
                      token = dai_token(
                        path = Sys.getenv("GSC_AUTH_FILE")
                        # scopes = "https://googleapis.com/auth/cloud-platform"
                        )
                      )

我不断收到 403 权限被拒绝错误。

File submitted at 2022-04-10 05:17:57. HTTP status: 403 - unsuccessful.
Error: "Permission 'documentai.processors.processOnline' denied on resource '//documentai.googleapis.com/projects/projectname/locations/us/processors/e4xxxxxxx' (or it may not exist)."
Response [https://us-documentai.googleapis.com/v1/projects/projectname/locations/us/processors/e46888f802fea83d:process]
  Date: 2022-04-10 05:17
  Status: 403
  Content-Type: application/json; charset=UTF-8
  Size: 649 B
{
  "error": {
    "code": 403,
    "message": "Permission 'documentai.processors.processOnline' denied on resource '//documentai.googleapis.com/projects/form-898-scan/locations/us/processors/e46...
    "status": "PERMISSION_DENIED",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.ErrorInfo",
        "reason": "IAM_PERMISSION_DENIED",
        "domain": "documentai.googleapis.com",
...

任何帮助将不胜感激!

I have been trying to authenticate from the parser API without success.
I have set up the google service account and created two keys.I Have set up the owner role and downloaded the credential json file.

googleAuthR::gar_auth_service("D:/898 sample/document ai/form-898-scan-bd4b8b48b570.json")
library(daiR)

response1 <- dai_sync("D:/test file.pdf"
                      ,
                      proj_id = get_project_id(path = "D:/crudentialabc123.json"),
                      proc_id = "e4xxxxxx",
                      loc = "us",
                      token = dai_token(
                        path = Sys.getenv("GSC_AUTH_FILE")
                        # scopes = "https://googleapis.com/auth/cloud-platform"
                        )
                      )

I keep getting the 403 permission denied error.

File submitted at 2022-04-10 05:17:57. HTTP status: 403 - unsuccessful.
Error: "Permission 'documentai.processors.processOnline' denied on resource '//documentai.googleapis.com/projects/projectname/locations/us/processors/e4xxxxxxx' (or it may not exist)."
Response [https://us-documentai.googleapis.com/v1/projects/projectname/locations/us/processors/e46888f802fea83d:process]
  Date: 2022-04-10 05:17
  Status: 403
  Content-Type: application/json; charset=UTF-8
  Size: 649 B
{
  "error": {
    "code": 403,
    "message": "Permission 'documentai.processors.processOnline' denied on resource '//documentai.googleapis.com/projects/form-898-scan/locations/us/processors/e46...
    "status": "PERMISSION_DENIED",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.ErrorInfo",
        "reason": "IAM_PERMISSION_DENIED",
        "domain": "documentai.googleapis.com",
...

Any help would be appreciated!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

高跟鞋的旋律 2025-01-27 05:01:03

我建议您使用R.

https://cran.r-project.org/web/packages/googleauthr/vignettes/google-authentication-ytypes.html

当前,Google Cloud cloud没有任何r的客户端库,但是列出的第三方软件包应该能够提供一个起点。

I would recommend reviewing this blog post about Google authentication using R.

https://cran.r-project.org/web/packages/googleAuthR/vignettes/google-authentication-types.html

Currently, Google Cloud doesn't have any client libraries for R, but the 3rd party packages listed should be able to provide a starting point.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文