Created 08-17-2023 07:01 AM
Hi there,
sorry for my silly question.
I have a InvokeHTTP processor which returns plaintext access token in the response body, since it is larger than 256 bytes I cannot assign it to an attribute. I need to use the token in another InvokeHTTP as a header to retrieve data. Token is a plain text (not a json).
Thanks!
Created 08-18-2023 02:36 AM
Hi,
If you're using Apache NiFi and the token you're trying to capture with the InvokeHTTP processor is too large to be stored as an attribute, you can follow the steps below to work around this limitation:
Keep the token in the content of the FlowFile if it's returned by the InvokeHTTP processor.
You can use processors like ReplaceText to wrap the token in the header format you need. For instance, if you need the header to be Authorization: Bearer {token}, then you can configure a ReplaceText processor to replace the content (i.e., the token) to match this format.
Created 08-17-2023 10:10 AM
@leqlaz777 Welcome to the Cloudera Community!
To help you get the best possible solution, I have tagged our NiFi experts @SAMSAL @cotopaul who may be able to assist you further.
Please keep us updated on your post, and we hope you find a satisfactory solution to your query.
Regards,
Diana Torres,Created 08-17-2023 11:22 AM
How are you authenticating? Are you using OAuth2 token for example? If so see if you can take advantage of the "OAuth2 Access Token provider" in the InvokeHttp processors where you set and configure your token provider as a service:
If that helps please accept solution.
Thanks
Created 08-18-2023 12:02 AM
Hi,
Not exactly oAuth2, I send Authorization: Bearer [API KEY] header to /auth endpoint via POST request and get a JWT access token. Which then I have to use as an auth header to access resources.
In StandardOauth2AccessTokenProvider I am not able to use simple Bearer token in header.
Created 08-17-2023 12:00 PM
@leqlaz777
What version of NiFi are you using?
How large is your response body?
I have no issues creating FlowFile Attributes with values larger then 256 bytes.
Can you share your processors being used and the configuration of them?
Thank you,
Matt
Created 08-18-2023 12:12 AM
Hi,
My version is 1.20.
It is a JWT token between 400-500 bytes.
I missed "Response Body Attribute Size" parameter, I can set arbitrary size to attribute. After changing it I am able to pass full length of my token.
Created 08-18-2023 02:36 AM
Hi,
If you're using Apache NiFi and the token you're trying to capture with the InvokeHTTP processor is too large to be stored as an attribute, you can follow the steps below to work around this limitation:
Keep the token in the content of the FlowFile if it's returned by the InvokeHTTP processor.
You can use processors like ReplaceText to wrap the token in the header format you need. For instance, if you need the header to be Authorization: Bearer {token}, then you can configure a ReplaceText processor to replace the content (i.e., the token) to match this format.