Google Document AI connector

I have gone through the Power Automate documentation in which there are a lots of premium connectors to connect a wide range of tools but for my purpose to connect Google Document AI is not there. If I connect Google Document AI through HTTP then there is token management issue because google change the token in every hour so in this case change manually token but this is not possible in production phase. So, I need a solution that connect Google Document AI and automatically refresh the token. Power automate also provide custom connector so, could anyone confirm is there I don’t need to manage those tokens or any other solution.

Hello @Nadeem_Akhtar,

It’s been quite a while since I last used Power Automate and I’m sure things have evolved significantly since then. I might be a bit out of touch so I’m answering based on what you mentioned about Power Automate that doesn’t offer a native connector for Google Document AI.

I recently faced a similar issue with a third-party tool that couldn’t handle OAuth2 properly. One effective workaround is to wrap the target API, in this case Document AI, behind your own HTTP endpoint using something simpler like Basic Auth or an API Key.

You can do this by deploying a small proxy with Cloud Run or Cloud Functions, and handle authentication either in code or through a gateway layer like API Gateway or Apigee.

Hi Nadeem_Akhtar,

You may try to follow these steps:

  1. Start in your Google Cloud project to enable the Document AI API and create an OAuth 2.0 Client ID. This provides the necessary credentials for Power Automate to identify itself to Google.

  2. Within Power Automate, create a new custom connector. Instead of using basic authentication or an API key, you will select OAuth 2.0 and input the credentials from your Google Cloud project.

  3. Specify Google’s standard endpoints for authorization and token exchange. A key step is to include the access_type=offline parameter in the authorization request, which explicitly tells Google to provide a refresh token. This is crucial for enabling the automatic refresh process.

  4. Define the specific Document AI functions you want to use, such as “process document.” This involves telling the connector what the API request looks like.

I found these reference that you may find helpful: