0

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!

Srividya
  • 1,678
  • 3
  • 10
Kai Peng
  • 57
  • 2
  • 6

1 Answers1

0

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.

Holt Skinner
  • 1,692
  • 1
  • 8
  • 21