Fortunately Apache NiFi already ships with a couple of processors which provide connections to Google APIs. But since there are dozens of Google APIs and they are also subject to changes from time to time, it's to expect that NiFi cannot offer a specialized processor for all of them out of the box. In our case we were missing a processor for the APIs of Search Console and Business Profile.
This is why we created this custom controller service which adds an alternative oauth2 access token provider besides the StandardOauth2AccessTokenProvider. It provides the access token generated by the GCPCredentialsControllerService service for the InvokeHTTP processor. This way it can be used to generate requests towards any Google API with https support.
- Download the latest .nar file from the release page.
- Copy it to the
lib
directory of your Apache NiFi deployment.
mvn clean install
cp nifi-gcp-oauth2-provider-nar/target/nifi-gcp-oauth2-provider-nar-1.0.0.nar $NIFI_HOME/lib
- Create and configure a GCPCredentialsControllerService controller service.
- Create a GCPOauth2AccessTokenProvider controller service (provided by this module).
- You can add one or multiple scopes if required (the required scopes are mentioned in the corresponding Google API documentation).
- You can delegate to another account if you want to impersonate it.
- Create an InvokeHTTP processor and select your GCPOauth2AccessTokenProvider for the field "Request OAuth2 Access Token Provider".
- Configure http method, http url and headers as explained by the corresponding API documentation (the flow file content is used as the request body).