I have been tasked with trying to use the Google DocumentAI service to extract table data from PDF files. I am using Alteryx, but the principle would apply to PostMan or other apps where you format your own requests.
I have set up a Google Cloud Bucket, and loaded up my PDFs. I have set up a project, and got a Service Account.
The documentation shows formatting a request, and has the Authorization header as "Authorization: Bearer gcloud auth application-default print-access-token".
Given that I have the credentials json file like this...
{
"type": "service_account",
"project_id": "my-proj",
"private_key_id": "12345abc",
"private_key": "-----BEGIN PRIVATE KEY-----\stuff\n-----END PRIVATE KEY-----\n",
"client_email": "me@my-proj.iam.gserviceaccount.com",
"client_id": "12345",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/me%40my-proj.iam.gserviceaccount.com"
}
... How do I get the bearer token? I assume I will have to make some kind of call to the identity server, but it is not clear how to do this.