Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Using dynamic property with StandardOauth2AccessTokenProvider

avatar
New Contributor

Hi, 

I am looking to use invokehttp with StandardOAuth2AccessTokenProvider controller to automatically get Access Token and make the API call with the token. The requirement to get token has an extra field compared to standard OAUTH token :

Below is the curl command. It includes extra key called auth_chain.

 

curl --location 'https://xyedfrg.xom/access_token' \
--header 'content-type: application/x-www-form-urlencoded' \
--data-urlencode 'username=test' \
--data-urlencode 'password=test' \
--data-urlencode 'client_id=F1234rdcfhkv' \
--data-urlencode 'client_secret=test-secret' \
--data-urlencode 'grant_type=password' \
--data-urlencode 'auth_chain=OAuthLdapService'
 
But this is how the StandardOAuth2AccessTokenProvider looks:
AlphaNiFi_0-1719460304719.png

If I add auth_chain as property it errors out saying :

AlphaNiFi_1-1719460339925.png

How can I make this OAUTH call to get token using invoke http.

*please note, cannot use the option provided here (https://community.cloudera.com/t5/Support-Questions/NIFI-Is-it-possible-to-make-a-x-www-form-urlenco...), as it exposes the credentials in data provenance and application layer and network layer too.

 

2 REPLIES 2

avatar
Community Manager

@AlphaNiFi, Welcome to our community! To help you get the best possible answer, I have tagged our NiFi experts @SAMSAL @steven-matison @MattWho who may be able to assist you further.

Please feel free to provide any additional information or details about your query, and we hope that you will find a satisfactory solution to your question.



Regards,

Vidya Sargur,
Community Manager


Was your question answered? Make sure to mark the answer as the accepted solution.
If you find a reply useful, say thanks by clicking on the thumbs up button.
Learn more about the Cloudera Community:

avatar
Expert Contributor

Hello,

We you can try something like this.

Step 1 : Add an InvokeHTTP Processor to Generate the Token

Step 2: Extract Token Using EvaluateJsonPath Processor:

Step 3: Use the Token in a InvokeHTTP

Thanks,

Shakib M.