I want to implement Google Document AI to read invoice details in salesforce using Rest API. I found below Api detail which is working well.
Now to call this api I need Oauth token. I have tired to setup Named Credentials but getting error "No_Oauth_Token: Access token was not returned". Can you please guide me for this? Might be I am setting wrong Scope, so can you please let me know which scope I need to setup.
Currently scope:- https://www.googleapis.com/auth/cloud-platform
curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://LOCATION-documentai.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/processors/PROCESSOR_ID:process"
Also, if any other way is available, please suggest.
Looking forward to hear on this.
Thank you!
Looking for solution to get Google Authentication(Oauth) token which I can use to call Google Document AI api.
Here is the information about setting up OAuth 2.0 for Google Cloud
https://support.google.com/cloud/answer/6158849?hl=en
And General Information about using OAuth 2.0 with Google APIs
https://developers.google.com/identity/protocols/oauth2
In addition, the REST request provided is not complete. It looks like you got the sample from this page https://cloud.google.com/document-ai/docs/send-request
On this page, you can click on the purple variables to replace them with the appropriate values for your setup ( PROJECT_ID
, LOCATION
, etc)
I have done research base on above answer and found solution. Solution is to use JWT token. You can generate JWT token at your end and using that we can call google API to get valid Authentication token and then we can use respective Google APIs.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.