Getting Access Token
Hi. I'm new to working with Apache Nifi. Currently, I've Apache Nifi 2.3.0
I'm trying to get access_token so that I can use it in future API calls. Currently, I use Postman to test getting access_token value and it works. I want to do this via Nifi.
Here is what I setup Postman to get access_token
I'm currently using Postman in order to call an API that generates access_token that I will use later to call other APIs. I want to do the same using Apachi Nifi 2.3.0. The Apache Nifi should generate a file called tokens.txt that contains the access token. Here is what I do in Postman:
POST URL: https://URL/auth/token
Headers:
Content-Type: application/x-www-form-urlencoded;charset=UTF-8
Authorization: Basic <BASE_64_ENCODED_CLIENT_CREDENTIALS>
Body:
grant_type: client_credentials
The response is in JSON format and contains the access token, expiration time of the access token.
Here is an example response:
{
"access_token": "eyJ4NXQjUzI1NiI...KtK5elB38rcAbgFtVP9A",
"token_type": "Bearer",
"expires_in": 3600
}
What do I need to achieve?
I want to simulate the above in Apache Nifi where I get the access_token and then store it in a file. Every time a new access token arrives, it needs to re-write the value.
I tried to use the following components
GenerateFlowFile -> EncodeContent -> UpdateAttribute (headers and body) -> InvokeHTTP -> LogAttribute (API-Response) -> EvaluateJsonPath -> UpdateAttribute (filename) -> PutFile
But for some reason, the InvokeHTTP was not working (not getting the response in JSON format).

