Dileepa Jayakody
Dileepa Jayakody

Reputation: 555

Add Authorization Header in Apache Nifi InvokeHTTP Processor

In my dataflow configured in Apache Nifi, I have an API that requires Authorization header (bearer token) to invoke with a GET request. I'm trying to configure the InvokeHTTP processor for this, but it doesn't support Authorization headers by default.

How can I add the Authorization header (maybe as an Attribute) into the GET request using Nifi's InvokeHttp processor?

Upvotes: 3

Views: 10556

Answers (1)

Andy
Andy

Reputation: 14194

You can add as many "dynamic properties" to the processor config as you like and they will be passed as HTTP headers on the request. You can populate the token via parameter or general Expression Language in the property value, but be aware that if using variables/parameters, you won't be able to use sensitive parameters because those must be referenced exactly rather than combined, and in this case you'll need to prepend the value with Bearer . There is an open ticket to make authorization header usage (OAuth2 specifically) easier with this processor.

Upvotes: 2

Related Questions